Hi Grahal,
I’m just searching for a winning strategy in live! and for the moment I found nothing… So here is the backtest in 5mn TF with your proposition of TP 5 and SL 15. I’ve tried an optimisation with lots of other variables but no configuration brings gain. I will test other possibilities and post here if i find something good. But I am very careful, because all the promising backtests I’ve seen have lead to losses in demo or real.
Hi Aloysius the TP 5 and SL 15 I proposed were relevant only for the period I displayed / optimised over … 10,000 bars (and maybe going forward for weeks / months until there is an observed deviation from % winning trades and Gain to Loss ratio etc following optimisation)
Also if you backtested Gertrade version then you have backtested a 28 Sec TF version over 200,00 bars @ 5 Min TF?
Attached results of original Roberto 5 Min version over 100,000 bars @ £1 per point. I have only optimised TP, SL and the Trailing Stop Variables as below.
I am considering that Algos on this Thread may need optimising every 3 months / 5000 bars.
Cheers
GraHal
//-------------------------------------------------------------------------
// Klinger-Rvi-Lsma DAX 5 min
//-------------------------------------------------------------------------
DEFPARAM CumulateOrders = False
DEFPARAM FlatBefore = 090000 //no trades before 09:00:00
DEFPARAM FlatAfter = 213000 //no trades after 21:30:00
ONCE nLots = 1 //number of LOTs traded
ONCE TP = 20 //23 pips Take Profit
ONCE SL = 16 //16 pips Stop Loss
RviVal, RviSignal = CALL "RVI by John Ehlers"[7] //7
KlingerVal, KlingerTrigger = CALL "Klinger oscillator"[25,44,55,1] //25,44,55,1 (ema)
LeastSquareEMA = CALL "ELSMA - Least Square EMA"[11,4] //11,4
//***************************************************************************************
IF LongOnMarket THEN
IF close < LeastSquareEMA THEN
SELL AT MARKET //Exit LONGs when MACD reverses southwards
ENDIF
ENDIF
IF ShortOnMarket THEN
IF close > LeastSquareEMA THEN
EXITSHORT AT MARKET //Exit SHORTs when MACD reverses northwards
ENDIF
ENDIF
//***************************************************************************************
trailingstart = 20//10 trailing will start @trailinstart points profit
trailingstep = 2 //13 trailing step to move the "stoploss"
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
newSL = tradeprice(1)+trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
newSL = newSL+trailingstep*pipsize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
newSL = tradeprice(1)-trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
newSL = newSL-trailingstep*pipsize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
//***************************************************************************************
// LONG trades
//***************************************************************************************
a1 = close > open //BULLish bar
a2 = KlingerTrigger CROSSES OVER KlingerVal //Klinger trigger is going north
a3 = RviSignal CROSSES OVER RviVal //RVI long signal occurred
IF a1 AND a2 AND a3 THEN
BUY nLots CONTRACT AT MARKET
ENDIF
//***************************************************************************************
// SHORT trades
//***************************************************************************************
b1 = close < open //BEARish bar
b2 = KlingerTrigger CROSSES UNDER KlingerVal //Klinger trigger is going south
b3 = RviSignal CROSSES UNDER RviVal //RVI short signal occurred
IF b1 AND b2 AND b3 THEN
SELLSHORT nLots CONTRACT AT MARKET
ENDIF
//
SET TARGET PPROFIT TP
SET STOP PLOSS SL
@ Grahal,
I realized the importance of history, I recognize that 20,000 units of history on the TF below the minute, it seems to me insufficient to validate a strategy. Right now, I’m doing tests on a TF 1 min, but I’m facing a major problem, how is it possible to make optimizations of variables of a complete strategy on 100,000 units? My PC is not powerful enough for that.
I Grahal,
Yes I backtested Gertrade version for 28s, in 5mn TF, because you announced good results in this configuration. But your answer shows we have not the same approach of backtests: when a backtest is good for a little period it has been optimised for, and loosing at other periods, I don’t trust it and don’t think it will be good for some weeks. Anyway, here is the 200 000 bars backtest for Roberto code in 5mn, in the version you just posted: it looks promising, thank you.
@Gertrade you say … how is it possible to make optimizations of variables of a complete strategy on 100,000 units? My PC is not powerful enough for that … is your PC seeming to do nothing for ages then a quick spurt of results in the optimisation table then nothing then spurt … etc? If Yes then we all have that issue not matter how powerful our PCs … its due to optimise processing happening on the remote PRT Server.
If No to above, then what symptoms are you getting that makes you think you PC is not powerful enough?
GraHal
PS @Aloysius I do think same as you re not trusting if loose over longer Out of Sample / OOS period. Thank you for posting the 200,000 bar results.
@gertrade having said above re a spurt then a few results show in the Table then wait then another spurt etc … I have just backtested / optimised another Algo over 100,000 bars @ 5 Min TF and it completes in around 30 seconds with a lot less wait and a lot faster spurts.
So speed of optimising / backtest does depend on how complex the code is and if there any ‘ Indicator Calls’ (the code I’m checking doesn’t have any Calls).
GraHal