Hi ! Here is my first very simple code, for DOW M15 (tested with 100 000 periods). 1 contract, 10 000 €, spread 2.5 pts, 1€ / order to represent overnight charges.
Every comments (or test on 200000 periods) are welcome :-).
DEFPARAM CumulateOrders = False // Cumul des positions désactivé
noEntryBeforeTime = 000000
timeEnterBefore = time >= noEntryBeforeTime
noEntryAfterTime = 230000
timeEnterAfter = time < noEntryAfterTime
// Conditions pour ouvrir une position long
indicator1 = WilderAverage[20](close)-WilderAverage[50](close)
c1 = (indicator1 CROSSES OVER 0)
indicator5 = MACD[7,14,5] (close)
c5 = (indicator5 > 0)
IF c1 AND c5 AND timeEnterBefore AND timeEnterAfter THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions pour ouvrir une position short
indicator10 = WilderAverage[20](close)-WilderAverage[50](close)
c10 = (indicator10 CROSSES UNDER 0)
indicator13 = MACD[7,14,5] (close)
c13 = (indicator13 < 0)
IF NOT LONGONMARKET AND c10 AND c13 AND timeEnterBefore AND timeEnterAfter THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Stops et objectifs
SET STOP pLOSS 108
SET TARGET pPROFIT 525
Hi Juju,
Thanks for sharing your idea.
The strategy suffer from over optimization as you can see with 100k bars of out of sample testing. It is always a good idea to optimize with split periods between In Sample and Out Of Sample periods, to validate robustness of optimized variables.
Hi Juju,
Thanks for sharing your idea.
The strategy suffer from over optimization as you can see with 100k bars of out of sample testing. It is always a good idea to optimize with split periods between In Sample and Out Of Sample periods, to validate robustness of optimized variables.
Thank you Nicolas for the long term back testing ! 2019 alone seems a very good year, which is not the case the years before… Indeed, TP and SL are optimised only with my 100 approach, maybe someone could fin best values in the long term ? What would you advice for me with only a 100K approach ?
Finally, around 100% in 8 years (minus overnight charges, which might be high du to a very long time on market) : is this strategy worth optimizing it or is it quite common ? this 0 crossing of wilder average 20/50 is quitte efficient in my ‘manual’ trading setup and easy to automate. MACD prevents from taking too much wrong signals.
2019 alone seems a very good year, which is not the case the years before
Of course, and surely because of optimization! If you optimize your variables, any strategy would look good for sure. That’s why I encourage you to explore concept of optimization into splitted periods aka “walk forward analysis”. There are plenty of topics discussing concept of robustness, but you can start with these videos:
French videos:
https://www.prorealcode.com/blog/video-tutorials/analyse-walk-forward-prorealtime/
https://www.prorealcode.com/blog/video-tutorials/recapitulatif-sur-lutilisation-du-module-walk-sous-prorealtime/
French topic: https://www.prorealcode.com/topic/optimisation-et-analyse-walk-forward-_-aides/
Thank you Nicolas, i’ll go and read all that