Optimization moving average crossing strategy

Forums ProRealTime English forum ProOrder support Optimization moving average crossing strategy

Viewing 15 posts - 1 through 15 (of 186 total)
  • #122649

    I wanted to open a thread to share some results from Jan’s excellent algo which has recently been added to the library. This is a sort of strategy creation tool that scans 4900 combinations of moving averages and returns the crossing pair that gives the best results for your chosen instrument and TF. Needless to say, the possibilities are endless.

    One thing I like about it is that you can chose certain parameters in advance. For example, if you only wanted strategies with a certain risk/reward ratio you could enter a stop loss of 1% and target profit of 3% and it would find you a strategy that had historically returned those kind of results.

    Anyway, big thanks to Jan for this amazing piece of work. I made some modifications to his original and came up with these 3. All have passed WF and have been running on forward testing for a few days with good results. They’re optimized at 25k and results below represent an OOS walk back to 100k. MM is optional.

    4 users thanked author for this post.
    #122653

    here’s the codes.

    the DOW 1w was uploaded by mistake – it’s still a work in progress, best to ignore.

    8 users thanked author for this post.
    #122673

    They’re optimized at 25k and results below represent an OOS walk back to 100k.

    This is very impressive!

    Attached  … almost unbelievable for a 75K bars OOS walkback??

    We’re gonna be Rich, Rich, Rich!!! 🙂

    I’ll treat You & Jan to an all expenses week on my Yacht!! 🙂 (excuse the hype, feeling hyper or trying to be!)

    Thank You and also a very Special Thank You to Jan!

     

     

    1 user thanked author for this post.
    #122676

    All credit to Jan for putting all those MAs together – a lot of them i’d never even heard of before. The 1h SP does have an especially nice equity curve. DOW 30m is the weakest of the 3 and probably all can be improved. But sometimes simple is best – one indicator + stops and TP. Fewer variables = not much to go wrong.

    One thing that baffles me is how they work on a crossover basis if the period is the same? You’d think they’d just run in parallel?

    Attached is Jan’s original itf

    #122680

    One thing that baffles me is how they work on a crossover basis if the period is the same? You’d think they’d just run in parallel?

    But during optimisation one selects the pair that give best results surely? So the pair are 2 x different types of MA?  I need to look again.

    I had seen Jan’s Systems last week,

    We need to attribute the definition of the 66 of the (70) MA’s to Laurenzo in the post below in 2017.

    https://www.prorealcode.com/prorealtime-indicators/average-filter-regression/

     

    #122681

    So the pair are 2 x different types of MA?

    Yes, correct. But I don’t see why they should necessarily cross if running on the same period. It’s academic really, main thing is that it works!

    #122682

    We need to attribute the definition of the 66 of the (70) MA’s to Laurenzo in the post below in 2017.

    Ah, I hadn’t noticed that – well done Laurenzo!

    2 users thanked author for this post.
    #122755

    I wanted to thank Jan and you for your work. I immediately spotted Jan’s work but I wasn’t able to make the code work because of my level of training. I had unresolved problems with variables. Thanks again I will test now.

    #122762
    Jan

    One thing that baffles me is how they work on a crossover basis if the period is the same? You’d think they’d just run in parallel?

     

    If the MA and MAv2  are the same, no crossing will be made, so no trades generated, result will be zero (could be tried by fixing to one MA and MAv2)

    I will try to add code  to avoid the meaningless same MAs,  idea is to replace MA and MAv2 for i and j  in the variables.

    Then add at the top of the code:

    If i = j and i <> 69 then     // increase  first MA when the second is the same as the first

    i = i + 1

    endif

    i =  MA

    j = MAv2

     

    #122767

    Hi Jan, yes I understand that if the pair are the same there’s no result, what I meant is that I don’t immediately see the significance of a Hull MA (for example) crossing an EMA when both have period 15. More conventional is that a fast MA crosses a slow MA. Presumably that must be happening here as well but the speed of reaction is in the  MA formula rather than the number of periods?

    #122772
    Jan

    Hi nonetheless,

    thanks for the reaction.

    If you have a limited set of MA, you could also vary with (one) Period or even 2,

    As you said, possibilities are almost endless.

    #122775

    200K results on SP strategy.

    No MM and positionsize=6

    1 user thanked author for this post.
    #122778
    Jan

    To avoid comparing the same MA (assuming the periods remain fixed), which is then meaningless, the very simple code is:

    //Before all average definitions:

    if MAType <> MATypeV2 then

    //after all average definitions

    Endif

     

    Wrong code mentioned before, too complex:

    If i = j and i <> 69 then     // increase  first MA when the second is the same as the first

    i = i + 1

    endif

    i =  MA

    j = MAv2

    #122780

    speed of reaction is in the  MA formula rather than the number of periods?

    Yeah … in the past, I’ve had lots of MA’s on the same Chart and you would think they are the same MA but different periods … the MA Lines can be so different from each other.

    #122781

    200K results on SP strategy

    Thanks for that Francesco. I’m getting to the point where i dread the 200k results! Not much else i can do with the data I’ve got.

    If you’ve got 10 minutes to spare, might be interesting to rerun the MA search, keeping the rest of it as it is (SL, TP etc)

    Just comment out:

    ONCE MAType = 4
    ONCE MATypeV2 = 0

    then optimize for those, 0-69 each

    But only if you feel like it… 😁

Viewing 15 posts - 1 through 15 (of 186 total)

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