@ronny
in resume, you have this code?
because on backtest, they are a problem
//EURUSD(DFB) – IG MARKET
// TIME FRAME 1H
// PROBACKTEST TICK by TICK
// SPREAD 0.9 PIP
// ALE – KASPER – VONASI
DEFPARAM CumulateOrders = false
CP = 101 //Fractal Period
RSINum = 2
Ave = 7 //AverageTrueRange Period
TGLMult = 0.6 //ATR multipier for TGL
STPMult = 1.8 //ATR multiplier for StopLoss
AddOn = 1.1 //Added to STPMult for TakeProfit
RSIHighLevel = 80
RSILowLevel = 100 – RSIHighLevel
//KASPER CODE OF REINVESTMENT
Reinvest=1
if reinvest then
Capital = 5000
Risk = 1//0.1//in % pr position
StopLoss = AverageTrueRange[Ave] * STPMult
TakeProfit = AverageTrueRange[Ave] * STPMult + AddOn
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = (equity*(Risk/100))
MAXpositionsize=5
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(((maxrisk/StopLoss)))))
else
Positionsize=1
StopLoss = AverageTrueRange[Ave] * STPMult
TakeProfit = AverageTrueRange[Ave] * STPMult + AddOn
Endif
///BILL WILLIAM FRACTAL INDICATOR
if Close[cp] >= highest[2*cp+1](Close) then
LH = 1
else
LH = 0
endif
if Close[cp] <= lowest[2*cp+1](Close) then
LL = -1
else
LL = 0
endif
if LH = 1 then
HIL = Close[cp]
endif
if LL = -1 then
LOL = Close[cp]
endif
//CumulativeRSI2
RSI2 = (SUMMATION[RSINum](RSI[RSINum](Close)))/RSINum
RSILow = RSI2 < RSILowLevel
RSIHigh = RSI2 > RSIHighLevel
//LONG and SHORT CONDITIONS
if (time >=100000 and time < 230000) then
C1 = (close CROSSES OVER HIL)
D1 = (close CROSSES UNDER LOL)
IF c1 and NOT ShortOnMarket and RSIHigh THEN
PositionMultiple = (RSI2/100) + 1//Increase PositionSize depending on CumRSI2 level
PositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiple
PositionSize = Round(PositionSize * 100)
PositionSize = PositionSize / 100
BUY positionsize CONTRACT AT MARKET
ENDIF
IF D1 and NOT LongOnMarket and RSILow THEN
PositionMultiple = ((100-RSI2)/100) + 1//Increase PositionSize depending on CumRSI2 level
PositionSize = (PositionSize/((RSIHighLevel/100)+1)) * PositionMultiple
PositionSize = Round(PositionSize * 100)
PositionSize = PositionSize / 100
SELLSHORT positionsize CONTRACT AT MARKET
ENDIF
ENDIF
//TRAILING STOP
TGL = AverageTrueRange[Ave] * TGLMult
TGS = TGL
if not onmarket then
MAXPRICE = 0
MINPRICE = close
PriceExit = 0
ENDIF
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close)
if MAXPRICE-tradeprice(1)>=TGL*pointsize then
PriceExit = MAXPRICE-TGL*pointsize
ENDIF
ENDIF
if shortonmarket then
MINPRICE = MIN(MINPRICE,close)
if tradeprice(1)-MINPRICE>=TGS*pointsize then
PriceExit = MINPRICE+TGS*pointsize
ENDIF
ENDIF
if onmarket and PriceExit>0 then
EXITSHORT AT PriceExit STOP
SELL AT PriceExit STOP
ENDIF
set target profit TakeProfit
set stop ploss stoploss