Ftse 100 trend following & candlestick pattern 1hr strategy.
Forums › ProRealTime English forum › ProOrder support › Ftse 100 trend following & candlestick pattern 1hr strategy.
- This topic has 17 replies, 5 voices, and was last updated 5 years ago by
Francesco78.
-
-
07/10/2017 at 3:31 PM #40177
Hello everyone.
I have found this strategy on the FTSE 100 by playing with candlestick pattern.
In particular here I assumed that 2 doji bull/bear candle are followed by an hammerdown/hammerup candle.
I then added some momentum filter condition based on 3 simple moving average.
The optimization involve:
- the parameter x that define how much doji are the candle
- the profit target
- the trailing stop
Moving averages are not optimized, and long and short trailing stops are set to be the same to avoid overfitting.
Hope you like it.
Francesco
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778defparam cumulateorders = false///money managementreinv = 0leverage= 3IF REINV = 1 THEN // réinvestissementcapital = 10000 + strategyprofitn = (capital / 10000) *leverageelsen = 1ENDIF///market conditionsav1 = average[5](close)av2 = average[10](close)av3 = average[50](close)bull = close> av1 and close >av2 and close > av3bear = close <av1 and close <av2 and close <av3///optimized variablesx = 0.6PR = 50timestart = 070000timeend = 230000TG = 40///candle pattern defirnitionstimeok = time>timestart and time < timeenddojibull2 = open[2]<close[2] and abs(open[2]-close[2])/(high[2]-low[2])<xdojibull1 = open[1]<close[1] and abs(open[1]-close[1])/(high[1]-low[1])<xdojibear2 = open[2]>close[2] and abs(open[2]-close[2])/(high[2]-low[2])<xdojibear1 = open[1]>close[1] and abs(open[1]-close[1])/(high[1]-low[1])<xhammerup = min(open,close)>high-(high-low)/2 //and max(open,close) < min(open[1],close[1])hammerdown = max(open,close)<low+(high-low)/2 //and max(open,close)<min(open[1],close[1])//and timeok//trade conditionscl = (dojibull2 and dojibull1) and hammerdown and bullcs= (dojibear2 and dojibear1) and hammerup and bearif cs and timeok thensellshort n contract at marketendifif cl and timeok thenbuy n contract at marketendif///ttailing stopsif not onmarket thenMAXPRICE = 0MINPRICE = closePREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TG*pointsize thenPREZZOUSCITA = MAXPRICE-TG*pointsizeENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TG*pointsize thenPREZZOUSCITA = MINPRICE+TG*pointsizeENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIF//fixed profit targetset target pprofit PR07/10/2017 at 3:41 PM #40268Hi Francesco, another great addition, thank you.
I just made a WF analysis on a 200k bars basis and this is what I found (picture attached).
Even if the overall result is so-so, there are things that annoy me, please consider them as advises and don’t be offend 🙂
- I think I should use more than 5 WFA on this longer period, at least 10 (double size of your own test, made on 100k bars).
- the first IN SAMPLE result is not good
- some of the OOS results are giving huge Walk Forward Ratio (+500% !)
- I used 10-100 for PR and TG with a 10 points step and all the best OOS optimized variables are set to 10 (?!)
Beside this, the strategy has performed well before the start of your own 100k bar backtest, that’s why I’m a bit perplexed of the whole analysis..
What were the settings of your optimisation for PR and PG please?
07/10/2017 at 4:10 PM #40270Thank you Nicolas, no offense at all! I am actually happy to see that you spent some time to analyse the strategy in more details.
My settings for the WF were the same as yours, I also considered x as a variables ranging from 0.4 to 0.6 with steps 0.1.
Im running it again in order to give you the details of the optimal value for the variables in the different IN SAMPLE and will let you know
07/10/2017 at 4:21 PM #40272Not anchored 75/25
x / TG/ PR
- 0.4 /100/100
- 0.4 /80/ 90
- 0.4 /70 /70
- 0.4 /50/ 60
- 0.4/ 60 /70
07/11/2017 at 11:24 AM #40339HI Nicolas, do you get the same results as I get on the 100k bar?
Thanks
Francesco
07/13/2017 at 10:57 AM #40536Did not test on 100k bar but as far as I could do in tick mode with another try here with 9 OOS periods.
1 user thanked author for this post.
07/13/2017 at 11:41 AM #40544Thank you Nicolas, just for my info if you optimize without WF on the 200k bars how does it look?
Many thanks
10/10/2017 at 12:29 AM #4883810/15/2017 at 7:29 AM #4938710/16/2017 at 8:33 AM #4948910/16/2017 at 8:36 AM #49491Another great idea Francesco! And many thanks to you Nicolas. Will keep working on this with WF testing and such. The shorting looks insane in ftse!
Interesting results nicolas.
Also im interested in hearing about your thoughts about this: If a strategy is optimized for 1 market, lets say FTSE. Then you copy/paste that same strat on lets say DAX. If it shows positive results and steady curve, does this make the strategy more robust and sturdy? Or is this a useless thing to look for?
Im sorry if you guys think this is too off topic! Great strategy, great work.
Another question for you Francesco, i’ve seen a screenshot of some of your portfolio numbers, mighty impressive 🙂
I was just wondering, how long did it take you to make your first profitable strategy, and are you still running it?
and follow up regarding the question over: Have you had a strategy that was profitable, but stopped being profitable? How did u notice and when did you draw the line? Maybe when the max drawdown on backtest was beaten? (as in you’ve lost more than your backtested max drawdown?
I mean, when can you say that your strategy was too curve-fitted and not working in the real market anymore?
In other words: The more universal strat = better?
Please share your knowledge on this if possible! What does your experience tell you? 🙂
Also i got a question about running the same strategy on the same timeframe but on different markets with different optimized variables. Is this generally a stupid idea? Is it better to run the one strategy on just 1 market, then work on a new strategy?
10/16/2017 at 3:51 PM #4958410/19/2017 at 1:44 PM #4994210/19/2017 at 1:51 PM #49945The only divisions I see that could generate this error are between lines 32 to 35. A rough solution would be to include these lines with a condition that make sure the differences between highs and lows are strictly superior to 0:
123456if (high[2]-low[2])>0 and (high[1]-low[1])>0 thendojibull2 = open[2]<close[2] and abs(open[2]-close[2])/(high[2]-low[2])<xdojibull1 = open[1]<close[1] and abs(open[1]-close[1])/(high[1]-low[1])<xdojibear2 = open[2]>close[2] and abs(open[2]-close[2])/(high[2]-low[2])<xdojibear1 = open[1]>close[1] and abs(open[1]-close[1])/(high[1]-low[1])<xendif2 users thanked author for this post.
10/19/2017 at 2:10 PM #49949what I normally do is the following:
dojibull2 = open[2]<close[2] and abs(open[2]–close[2])/(high[2]–low[2]+0.00000001)<xdojibull1= open[1]<close[1] and abs(open[1]–close[1])/(high[1]–low[1]+0.00000001)<xdojibear2= open[2]>close[2] and abs(open[2]–close[2])/(high[2]–low[2]+0.00000001)<xdojibear1= open[1]>close[1] and abs(open[1]–close[1])/(high[1]–low[1]+0.00000001)<x1 user thanked author for this post.
-
AuthorPosts