D.I.+RSIOMA Trend Following on Dax
Forums › ProRealTime English forum › ProOrder support › D.I.+RSIOMA Trend Following on Dax
- This topic has 9 replies, 2 voices, and was last updated 5 years ago by Vonasi.
-
-
07/01/2018 at 2:41 PM #75002
Hi guys,
I was trying to figure out some strategies with a mtf trend background and entry in direction of it, and I found this out:
a double-Directional Movement to set the direction of the trend, and RSIOMA crossing overbought or oversold for entry signal.
A little bit of money management (to improve possibly with your help) optimization and here an interesting result on 100k backtest.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879//ADX+RSIOMA Trend Follower by AlexF81//DAX 1H optimized on 100k barsDEFPARAM CUMULATEORDERS=true//time and daysdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0TODFromHour = 090000 //time of the dayTODToHour = 170000 //time of the dayinTimeInterval = time>=TODFromHour and time<TODToHour//indicatorsADX89=DI[89](close)ADX144=DI[144](close)trendlong=ADX89>0 and ADX144>0trendshort=ADX89<0 and ADX144<0ma=ExponentialAverage[14](WeightedClose)rsioma=rsi[14](ma)entrylong=rsioma crosses over 80entryshort=rsioma crosses under 20///////////////////////////////////////////if inTimeInterval and not daysForbiddenEntry and trendlong and entrylong thenbuy 1 contracts at marketendifif inTimeInterval and not daysForbiddenEntry and trendshort and entryshort thensellshort 1 contracts at marketendif////money management - breakevenstartBreakeven = 10 //how much pips/points in gain to activate the breakeven function?PointsToKeep = 2 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated//reset the breakevenLevel when no trade are on marketIF NOT ONMARKET THENbreakevenLevel=0ENDIF// --- BUY SIDE ---//test if the price have moved favourably of "startBreakeven" points alreadyIF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN//calculate the breakevenLevelbreakevenLevel = tradeprice(1)+PointsToKeep*pipsizeENDIF//place the new stop orders on market at breakevenLevelIF breakevenLevel>0 THENSELL AT breakevenLevel STOPENDIF// --- end of BUY SIDE ---//sell sideIF SHORTONMARKET AND tradeprice(1)-close>startBreakeven*pipsize THEN//calculate the breakevenLevelbreakevenLevel = tradeprice(1)-PointsToKeep*pipsizeENDIF//place the new stop orders on market at breakevenLevelIF breakevenLevel>0 THENEXITSHORT AT breakevenLevel STOPENDIF//SuperTrend as Trailing and StopmySuper=1.5*Supertrend[3,10]if longonmarket and close crosses under mySuper thensell at marketendifif shortonmarket and close crosses over mySuper thenexitshort at marketendifset target pprofit 20007/01/2018 at 3:46 PM #75008By just making sure that any additional positions are only bought at a more favourable price you can improve the gain/loss ratio, gain per trade and win rate considerably and make a nicer equity curve. This is obviously at the cost of less trades which in real life is a good thing but for a back test result is a bad thing as you have a smaller data sample to build confidence in the results.
I used a spread of 2 and my equity curve with your code was much uglier than yours – what spread did you use? My trading time may be different too – what time are you trading on?
I got these results with that simple addition:
07/01/2018 at 3:48 PM #7501207/01/2018 at 3:52 PM #7501407/01/2018 at 3:55 PM #7501807/01/2018 at 4:08 PM #7501907/01/2018 at 4:18 PM #75022I changed lines 25 to 31 with this:
123456789101112131415if not longonmarket and inTimeInterval and not daysForbiddenEntry and trendlong and entrylong thenbuy 1 contracts at marketendifif longonmarket and inTimeInterval and not daysForbiddenEntry and trendlong and entrylong and close < positionprice thenbuy 1 contracts at marketendifif not shortonmarket and inTimeInterval and not daysForbiddenEntry and trendshort and entryshort thensellshort 1 contracts at marketendifif shortonmarket and inTimeInterval and not daysForbiddenEntry and trendshort and entryshort and close > positionprice thensellshort 1 contracts at marketendif1 user thanked author for this post.
07/01/2018 at 4:29 PM #7502307/01/2018 at 4:29 PM #7502407/01/2018 at 4:34 PM #75028This is the code used in that last idea. It also changed not longonmarket and not shortonmarket to not onmarket.
123456789101112131415if not onmarket and inTimeInterval and not daysForbiddenEntry and trendlong and entrylong thenbuy 1 contracts at marketendifif longonmarket and inTimeInterval and not daysForbiddenEntry and entrylong and close < positionprice thenbuy 1 contracts at marketendifif not onmarket and inTimeInterval and not daysForbiddenEntry and trendshort and entryshort thensellshort 1 contracts at marketendifif shortonmarket and inTimeInterval and not daysForbiddenEntry and entryshort and close > positionprice thensellshort 1 contracts at marketendif -
AuthorPosts
Find exclusive trading pro-tools on