Strategy Break MM7

Forums ProRealTime English forum ProOrder support Strategy Break MM7

  • This topic has 13 replies, 5 voices, and was last updated 3 years ago by avatarLéo.
Viewing 14 posts - 1 through 14 (of 14 total)
  • #138552

    Dear All,

    I hope I am posting this subject in the correct section of the website.

    I have no experience in programming and I think that the best way  for me to understand the codes posted on this website is to try to work on my own projects.

    Therefore I tried to write the code below, the idea is to take position when prices crosses MM7 and x prior closes are above or under MM7. A lot of it is based on the SL strategies that I found in a thread created by Gianluca and originaly developped by Nicolas and Ale.

    I assume there is a lot of mistakes in this code, but I hardly see my mistake myself.

    Can you please comment on this ?

    Thank you all for your contribution to this website, very much appreciated.

    Best regards.

    Alex.

     

    #141636

    Dear All,

    still trying to work on this strategy.

    I tried the code below which works well on long position but does not take any short position.

    I think I must be missing something very obvious.

    Could someone help please ?

    Best regards.

    Alex.

     

    #141665

    Change SELL to SELLSHORT in line 22.

    BUY opens a long position.

    SELL closes a long position

    SELLSHORT opens a short position.

    EXITSHORT closes a short position.

    1 user thanked author for this post.
    #141676

    SMA should be as below, but as Longs have executed then I guess the default (Close) is being assumed by the code?

     

     

    1 user thanked author for this post.
    #141677

    Yes GraHal, CLOSE is assumed if that parameter is missing.

    But I prefer to always add all parameters without caring about built-in assumptions.

     

    2 users thanked author for this post.
    #141830

    Dear Grahal, Vonasi and Roberto,

    Thank you for your help – much appreciated.

    I updated the code accordingly and backtested on Dow Jones in 1H. Results are not great Especially prior to 2015 but not so bad since.

    I will try to optimize X and SMA and repost it here if I find good parameters.

    Thank you again for your help.

     

     

     

    #141907

    Hi All,

    I simplified the code as below and tested different combinations for PMM and X.

    Best results for Dow H1 are with PMM=154 and X=77. (2020 show particularly good results as it was able to capture most of the Feb/March adjustment).

    Results are even better with larger SL but I found 300 good for now.

    As mentionned this is experimental, but I am happy to hear your comments.

    Thanks.

    Alex.

     

    #141915

    Beware of over fitting. Divide your optimizing period into at least 1 IS+ 1 OOS periods.

    Optimize on 70% of history (In-Sample period) and test the robustness (validation of optimized variables) with the 30% of history (the Out Of Sample period). You can automate this process with the walk forward tool: https://www.prorealcode.com/blog/learning/prorealtime-walk-analysis-tool/

    (french videos: Analyse Walk Forward avec ProRealTime et Récapitulatif sur l’utilisation du module Walk Forward sous ProRealTime)

    1 user thanked author for this post.
    #141933

    Dear Nicolas,

    Thank you for this link. I have been through them now and will try backtest + roll forward and post the results here.

    Best regards.

    #142022

    Dear Nicolas,

    I worked on parameters using one IS / OOS (70/30) period as suggested (Dow 1h, 200’000 bars, Tick by tick mode).

    WFE is 53,8 % using 150 for PMM and 112 for XX – which I understand is not so bad. I understand it would make sense to have more than one IS/OOS but it is running super slowly.

    Alex.

     

    #142042

    That’s how you have to proceed, well done. If you have put your strategy live at the same moment of the vertical dotted line, then you had made this nice profit (of the OOS period).

    #142087

    Thank you Nicolas !

    Draw down is important and got worst on the OOS period.

    Despite a RR of 2 I am not sure this would be worse to try live !

    Alex

    #142095

    Ok, that’s why robustness test is important and should by conducted by anyone creating strategies.

    #143201

    Dear Nicolas,

    Maybe you can help to understand the issue I have.

    I am testing the code below with variables to optimize PMM, XX, SLa and TPa.

    The walk forward analysis below (TEST MM7 Break(7)) shows that the best variables would be PMM = 6 or 7, XX = 5 and SLa and TPa = 5 (200 K bares, Tick by tick, spread = 1 )

    When I replace the variables in the code for PMM=6, XX=5 SLa=5 and TPa=5 (Test MM7 Break(9)) or PMM=7, XX=5 SLa=5 and TPa=5 (Test MM7 Break(10)) the stratgey fails after few months (200 K bares, Tick by tick, spread = 1 ).

    I would have expected a gain curve more or less in line with the results of the walkforward analysis.

    I definetly miss something – Can you please help ?

    Thank you !

    Alex.

     

     

Viewing 14 posts - 1 through 14 (of 14 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login