DOW 2h TREND CHASER v4 MM
Forums › ProRealTime English forum › ProOrder support › DOW 2h TREND CHASER v4 MM
- This topic has 26 replies, 4 voices, and was last updated 4 years ago by nonetheless.
-
-
01/12/2020 at 12:45 AM #116471
This is a reworking of TREND CHASER v2.0 posted by Mike GC (he also did a v3, so mine is v4). I added a trailing stop and some other tweaks, then thought to replace cumulateorders = true with money management. That went well enough, but then I thought, why not have both cumulateorders and MM? Is this a bad idea? It seems to work (+1400% over ~4 years) and is certainly in keeping with what I would do in real world trading. Off to a good start in demo over the past week…
Of course, when I get results like this, my first assumption is that I’ve probably blundered somewhere and it’s all TG2Btrue. I’d be most grateful if someone could take a look to confirm this, just to put my mind to rest. Thanks.
See attached for WF results.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111DEFPARAM CumulateOrders = true // Cumulating positions activatedMoneyManagement = 1//MoneyManagement = Set to 0 for level stakes. Set to 1 for increasing stake size as profits increase and decreasing stake size as profits decrease. Set to 2 for increasing stake size as profits increase with stake size never being decreased.Capital = 10000MinSize = 1//MinSize = The minimum position size allowed for the instrument.Equity = Capital + StrategyProfitIF MoneyManagement = 1 THENPositionSize = Max(MinSize, Equity * (MinSize/Capital))ENDIFIF MoneyManagement = 2 THENPositionSize = Max(LastSize, Equity * (MinSize/Capital))LastSize = PositionSizeENDIFIF MoneyManagement <> 1 and MoneyManagement <> 2 THENPositionSize = MinSizeENDIFPositionSize = Round(PositionSize)// Size of POSITIONSPositionSizeLong = 1 * positionsizePositionSizeShort = 1 * positionsize// IndicatorsCOI = WEIGHTEDAVERAGE[10](ROC[14] +ROC[11])MAC = MACDline[12,26,9](close)STO = Stochastic[14,3](close)ST = Supertrend[8,16]// Conditions to enter long positionsc1 = COI > COI[1] AND COI < 0c2 = MAC > MAC[1] AND MAC < 0c3 = STO > 23 AND STO < 44IF Not ShortOnMarket AND c1 AND c2 AND c3 THENBUY PositionSizeLong CONTRACT AT MARKETENDIF// Conditions to exit long positionsc4 = close crosses over STIF c4 THENSELL AT MARKETENDIF// Conditions to enter short positionsc5 = COI < COI[1] AND COI > 0c6 = MAC < MAC[1] AND MAC > 0c7 = STO < 74 AND STO > 58IF Not LongOnMarket AND c5 AND c6 AND c7 THENSELLSHORT PositionSizeShort CONTRACT AT MARKETENDIF// Conditions to exit short positionsc8 = close crosses under STIF c8 THENEXITSHORT AT MARKETENDIF//trailing stop functiontrailingstart = 43 //trailing will start @trailinstart points profittrailingstep = 3 //trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF//************************************************************************01/12/2020 at 8:20 AM #116479You should never walk forward test with money management turned on. Walk forward tests should always be carried out with level stakes unless the money management is part of the strategy where position size is altered up and down based on some sort of trade risk calculation.
Personally I like to forward demo test with level stakes too because then I can easily compare like for like all the strategies on forward test. If one is good enough to go live then I would put it live with level stakes for a short while just to double check that it behaves itself before turning money management on to try to maximise returns.
Being in a rush to get rich can often lead to a rush towards being poor!
01/12/2020 at 8:31 AM #116481My last post just gave me a coding idea. It would be good to add a trade count to the money management and then automate the switch from trading without money management to trading with it. We could have the code check that say 100 trades (or the quantity of your choice) have taken place and that we are in say 5% profit and then turn it on. This would mean that we don’t have to stop strategies and modify them thus losing the trading results when we start the strategy again. It is also one more decision that is automated for those of us who hate making trading decisions!
2 users thanked author for this post.
01/12/2020 at 1:25 PM #116503Walk forward tests should always be carried out with level stakes
I agree and should have mentioned that I had already done that. Attached are the WF results with no MM, cumulateorders true and false. As one would expect, level stakes gives the smoothest curve.
1 user thanked author for this post.
01/12/2020 at 1:59 PM #116508I couldn’t face WF … so tediously slow at the weekend!!??
So here is an alternative view attached … opti over 100k bars and I …
- Added a filter on the shorts (Close < MA(750) – lower curve.
- Vonasi MM code – upper curve.
I’m hoping if Vonasi adds code to cease MM after losses then we might see that dip at the end of 2019 reduce somewhat?
01/12/2020 at 2:33 PM #116516One thing I don’t understand about this code are the exit lines 49 and 66. Sounds wrong to have a long position close when it crosses over the SuperTrend and short to close when crossing under. To my mind it should be the opposite, but that doesn’t work at all.
@GraHal, what’s the actual line of code you added?
With MoneyManagement = 1 it should reduce position size as profit falls.
01/12/2020 at 3:11 PM #116519@GraHal, what’s the actual line of code you added?
I added the MA as a Filter to Line 66
1234IF Not LongOnMarket AND c5 AND c6 AND c7 and Close < Average[A66](close) THENSELLSHORT PositionSizeShort CONTRACT AT MARKETENDIF1 user thanked author for this post.
01/12/2020 at 3:12 PM #116520@nonetheless If there is not long or not short onmarket position in your entry criteria then it ignores an opposite signal. In an optimisation process however I think it should be possible to revert straight to another direction.
If you have it like it is as right now, maybe it’s better to run the optimisation for long & short separate?
01/12/2020 at 3:39 PM #116523maybe it’s better to run the optimisation for long & short separate?
Thanks Paul, I’ll try that.
01/12/2020 at 9:04 PM #11654701/12/2020 at 9:30 PM #116552@GraHal very nice!
Then there’s another issue, the correct settings for the trailing stop. Because now the trailingstop doesn’t reset properly.
It’s this part
123IF NOT ONMARKET THENnewSL=0ENDIFfirst line replaced with
1if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thenIn a strategy on the dow, it appeared that some trades had 0 bars which isn’t good. Didn’t happend on the dax. Found the cause the be the exit on the trailing stop.
Separating the exit fixed that problem. Like this;
So instead of this
1234IF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIFuse
12345678910if longonmarket thenif newSL>0 thensell at newSL stopendifendifif shortonmarket thenif newSL>0 thenexitshort at newSL stopendifendifSmall things, I think it’s correct with above. Maybe it doesn’t matter much at all, but it could be your new optimised results go down a bit 🙂
01/12/2020 at 9:48 PM #116554Did you add more variables to your optimization? What do the last 4 numbers in the brackets refer to: 6,250 50 2 ?
Is this with MM=0 and cumalateorders = False ?
01/12/2020 at 10:32 PM #116564What do the last 4 numbers in the brackets refer to: 6,250 50 2 ?
See attached .itf.
You have prob gathered by now … I use line numbers as variable names. When I add code then the line numbers get out of synch with the Lines in the code. but the descriptor is still valid, e.g. A23 may end up on Line 26.
It does seem very versatile this System … got rid of the drop at the end of 2019 and got a superlative set of performance results … Image 2 relates to the top curve. Profit has dropped but so has the drawdown!
It now all needs WF (tomorrow when WF is faster!) as most of the money was made up to 1st Qtr of 2018.
Now to look at Paul’s latest suggestion! 🙂
01/12/2020 at 11:11 PM #116568Ok, got it. So you’re running MM=1 and CumulateOrders = False. But if it’s one or the other, CumulateOrders = true seems to have the more dramatic effect on profit.
01/12/2020 at 11:20 PM #116571CumulateOrders = true seems to have the more dramatic effect on profit.
Yeah but could I go to sleep at night knowing that I might wake up to having 15 positions on the Dow?? 🙂
-
AuthorPosts
Find exclusive trading pro-tools on