REM XARONS PIVOT-TRIGGER
REM **********************
REM DAX Variante
REM **********************
REM siehe Infodatei if.txt
REM **********************


REM PIVOT-TRIGGER ermitteln

highD = (high+High[1]+High[2])/3
lowD = (low+low[1]+low[2])/3
closeD=(close+close[1]+close[2])/3
piv = (highD+lowD+closeD)/3
longtrigger = ((2*piv)-lowD)
shorttrigger = ((2*piv)-highD)

REM **********************
REM Variablen auswerten
REM **********************

if equ*(riskpercent/100) >= longtrigger[1]-shorttrigger[1] then
	rk= (equ*(riskpercent/100))
	rz= (longtrigger[1]-shorttrigger[1])
	kontraktzahl=round(rk/rz)
	
else
	
	kontraktzahl = 0
	
endif



REM ************************
REM Gewinn und Verlust heute
REM ************************

REM 1. LONGTRIGGER wurde ausgelst / SHORTTRIGGER nicht
REM Startdatum wird bercksichtigt

if Date>=dt then
	
	if high > longtrigger[1] and low > shorttrigger[1]  then
		
		REM ** Open schon ber Longtrigger ?? **
		
		if open>longtrigger[1] then
			
			gv = 0
			REM ** Wenn nicht, dann... **
			
		else
			
			gv = kontraktzahl*((close-longtrigger[1])-spread)
			
		endif
		
		REM 2. SHORTTRIGGER wurde ausgelst / LONGTRIGGER nicht
		
	elsif high<longtrigger[1] and low<shorttrigger[1] then
		
		REM ** Open schon unter SHORTTRIGGER ?? **
		
		if open<shorttrigger[1] then
			
			gv=0
			
			REM ** Wenn nicht, dann.. **
			
		else
			
			gv=kontraktzahl*((shorttrigger[1]-close)-spread)
			
		endif
		
		REM 3. SHORTTRIGGER & LONGTRIGGER ausgelst >> Position ausgestoppt :-(
		
	elsif high>longtrigger[1] and low<shorttrigger[1] and open>shorttrigger[1] and open<longtrigger[1]  then
		
		gv=kontraktzahl*((shorttrigger[1]-longtrigger[1])-spread)
		
		
		REM 4. in allen anderen Fllen
		
	else
		gv=0
		
	endif
	
else
	gv=0
endif

REM ** Aufsummierung der Punkte **
REM ** Ausgabe **

gewinn = cumsum(gv)

equ=eq+gewinn


return equ




