CNParticipant
Senior
What might the reason be for the sudden loss in momentum?
What might the reason be for the sudden loss in momentum?
At a guess the take profit and stop loss levels just happen to fit the period that it was developed on better than the period since then. This is always a problem with TP and SL levels they are very easy to curve fit to past data. The general theory of the strategy is good but the difference between profits and loss will always come down to how the market is currently moving in relation to these TP and SL fixed levels.
IMO, this is a great strategy with nice potential, OOS speaks for itself.
IMO, this is a great strategy with nice potential, OOS speaks for itself.
I don’t disagree – I just think it is difficult to get excited about the OOS 18.2 pips profit over six trades in one year and 90% of that profit came from just two trades. The lack of any losing trades is exciting though.
It will be interesting to see how this one continues with further real life forward testing.
Can anybody see why I am getting the Rejects for the reason shown (red arrow) on the code below please?
Why is the code trying to take a limit position at a price that is clearly not obtainable (blue arrow)?
And then – in the same second, 100012 code tried to take a stop position at a realistic price as expected ( black arrow).
Version below may include changes I have made.
Hope that makes sense?
Thank You in Advance
//-------------------------------------------------------------------------
// Main code : ! Fractal BOut EURUSD 1H RonGH
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Main code : ! Fractal BOut EURUSD 1H RonGH
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Main code : ! Fractal BOut EURUSD 1H RonGH
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Main code : ! Fractal BOut EURUSD 1H RonGH
//-------------------------------------------------------------------------
//https://www.prorealcode.com/topic/fractal-breakout-intraday-strategy-eurusd-1h/page/20/
//Ronny #48560
//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=0 //change
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=Capital
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(((maxrisk/StopLoss)))))
else
Positionsize=2
TakeProfit = 40 //change
StopLoss = 50 //change
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
Related to limited risk account I guess. Stoploss can’t be too far related to the margin required..
Stoploss can’t be too far related to the margin required..
This is why I am confused … isn’t the StopLoss = 50 at Line 50 and used in Line 124 (set stop ploss stoploss)?
Also it is Limit Orders (not Stops) that are being rejected as being too far from price.
You need to add a p
set target pprofit TakeProfit\
@GraHal TGL is 0, because it’s a price and does not need to be converted using POINTSIZE. Replace those lines with:
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close)
if MAXPRICE-tradeprice(1)>=TGL then//*pointsize then
PriceExit = MAXPRICE-TGL//*pointsize
ENDIF
ENDIF
if shortonmarket then
MINPRICE = MIN(MINPRICE,close)
if tradeprice(1)-MINPRICE>=TGS then//*pointsize then
PriceExit = MINPRICE+TGS//*pointsize
ENDIF
ENDIF
This will affect performance a bit.
You don’t need to add a P, since those values are differences in price, not in Pips,
Hello Guys, how can I find the last updated code from Ale? There are a lot of posts… Grazie / Thanks Giuseppe
You don’t need to add a P, since those values are differences in price, not in Pips,
You are right, but it doesn’t matter if the instrument has a pipsize = 1, and this is the case for DAX.
Nicolas, this is EurUsd, not DAX.
Indeed lines 49-50 should have * POINTSIZE before the comment, so their values match lines 38-39 which are in price (probably Francesco78 referred to lines 49-50). So GraHal will have to choose one of the two ways and use PROFIT/LOSS with/without P accordingly.
Thanks guys
hahahah I’ve tried 4 combinations of your suggestions and results just get better and better! 🙂
Now to start thinking what is really happening and interpreting your suggestions?
Results seem too good to be true?