Optimization moving average crossing strategy
Forums › ProRealTime English forum › ProOrder support › Optimization moving average crossing strategy
- This topic has 185 replies, 11 voices, and was last updated 2 years ago by
slevinkelevra.
-
-
03/20/2020 at 12:13 AM #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.
03/20/2020 at 12:14 AM #122653here’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.
03/20/2020 at 10:15 AM #122673They’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.
03/20/2020 at 10:41 AM #122676All 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
03/20/2020 at 10:54 AM #122680One 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/
03/20/2020 at 10:58 AM #122681So 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!
03/20/2020 at 11:00 AM #122682We 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!
03/20/2020 at 6:32 PM #122755I 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.
03/20/2020 at 7:26 PM #122762One 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
03/20/2020 at 8:02 PM #122767Hi 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?
03/20/2020 at 10:28 PM #12277203/20/2020 at 10:49 PM #122775200K results on SP strategy.
No MM and positionsize=6
1 user thanked author for this post.
03/20/2020 at 11:05 PM #122778To 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
03/20/2020 at 11:15 PM #122780speed 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.
03/20/2020 at 11:55 PM #122781200K 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 = 0then optimize for those, 0-69 each
But only if you feel like it… 😁
-
AuthorPosts
Find exclusive trading pro-tools on