15Min EUR/USD Momentum Strategy
Forums › ProRealTime English forum › ProOrder support › 15Min EUR/USD Momentum Strategy
- This topic has 6 replies, 3 voices, and was last updated 7 years ago by GraHal.
-
-
03/08/2017 at 8:40 AM #27680
This is my first robot strategy, but I thought I’d share it to see anyone can improve it even further. It has been tested and configured to make a consistent profit gain going back to mid 2016.
This robot strategy is a momentum strategy to be run on the EUR/USD 15 Minute time frame only between 05:00 and 21:00 UK time.
It consists if 4 indicators: 16EMA, Stochastic, MACD and RSI.
This strategy is using the revised trailing stop code by Nicolas, which has improved the average loss of losing trades. I have had to program the exiting of trades on indicators to simulate a reversal price action once entered a trade, but as prorealtime code still does not support multiple time frames, I cannot see away around this. For example it would be beneficial to be able to exit a short trade after two consecutive 5 minute green candles, instead of having to wait for the full 15 minute candle to complete and the stop to kick in.
Overall the percentage of winning trades is lower, prior to mid 2016. Following some research, my findings were attributed to more whipsaws prior to 2016. Increasing the stop to 10 will improve this strategy prior to mid 2016.
To improve the % of winning trades, I would not run this strategy during quiet periods on holidays (Christmas etc) or during a major economic announcements where you may see a large Doji candle.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214Defparam PreloadBars=5000DEFPARAM CumulateOrders = false // Cumulating positions deactivated// The system will cancel all pending orders and close all positions at 21:00. No new ones will be allowed until after the "FLATBEFORE" time.DEFPARAM FLATBEFORE = 050000// Cancel all pending orders and close all positions at the "FLATAFTER" timeDEFPARAM FLATAFTER = 210000// Prevents the system from placing new orders on specified days of the weekdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions to enter long positionsindicator1 = ExponentialAverage[16](close)c1 = (close > indicator1)/// Only trade when Stoch is upwardsindicator2 = Stochastic[5,3](close)c2 = (indicator2 > indicator2[1])// stochastic 2 periods ago has to be lower to go longindicator3 = Stochastic[5,3](close)c3 = (indicator3[2] < indicator3)indicator5 = Stochastic[5,3](close)c5 = (indicator5[1] < 70)indicator6 = MACDline[5,35,5](close)c6 = (indicator6 > -0.0001)indicator7 = ExponentialAverage[5](MACDline[5,35,5](close))c7 = (indicator7 > -0.00016)indicator8 = RSI[14]c8 = (indicator8 >=50)// close to a higher openhigheropen = open > (close[1] -3)// dont open if a dojiNodoji1 = abs(open-close) > 0// dont open if a loose dojiDoji7 = abs(open - close)loosedoji1 = Doji7 > .00027Doji6 = abs(open[1] - close[1])loosedoji2 = Doji6 >= .00010// dont open on a red candle// redcandle = (Close < Open)// dont open if long candle bodycandlebody = abs(open - close) < 0.00086// if candle is red, don't go longnoredcandle = (close - open) > 0// if 2 red candles in a row// noredcandles = (close - open > 0 AND close[1] - open[1] > 0)// close price is close to upper boll, don't enter trade// indicator99 = BollingerUp[20](close)// c99 = ABS(close-indicator99 > 12)IF ( c1 AND c2 AND c3 AND c5 AND c6 AND c7 AND c8 AND Nodoji1 AND higheropen AND loosedoji1 AND loosedoji2 AND candlebody AND noredcandle) AND not daysForbiddenEntry AND not LONGONMARKET THENBUY 5 CONTRACT AT MARKETENDIF// Conditions to exit long positions// close when you get a strict DojiDoji1 = (Open = Close)c8 = Doji1// close when you get a small bodied red candleDoji2 = ABS(Open - Close) < .00014c10 = Doji2IF LONGONMARKET AND (c8 OR c10) THENSELL AT MARKETENDIF// Conditions to enter short positionsindicator18 = ExponentialAverage[16](close)c18 = (close < indicator18)/// Only trade when Stoch is downwardsindicator21 = Stochastic[5,3](close)c21 = (indicator21 < indicator21[1])indicator13 = Stochastic[5,3](close)c13 = (indicator13[1] > 30)// MACD minus Signalindicator14 = MACDline[5,35,5](close)c14 = (indicator14 < 0.0001)// MACD Signalindicator16 = ExponentialAverage[5](MACDline[5,35,5](close))c16 = (indicator16 <= 0)indicator17 = RSI[14]c17 = (indicator17 <=50)// stochastic 3 periods ago has to be higher to go shortindicator18 = Stochastic[5,3](close)c18 = (indicator18[3] > indicator18)// dont open if a dojiNodoji2 = abs(open-close) > 0// must be a close to a lower open// nearloweropen = open <= (close[1] + 2)// must be a strict lower openloweropen = open < (close[1])// if candle is green, don't go shortnogreencandle = (close - open) < 0IF (c21 AND c13 AND c14 AND c18 AND c16 AND c17 AND loweropen AND Nodoji2 AND loosedoji1 AND loosedoji2 AND candlebody AND nogreencandle ) AND not daysForbiddenEntry AND not SHORTONMARKET THENSELLSHORT 5 CONTRACT AT MARKETENDIF// Conditions to exit short positions// close when you get a strict DojiDoji1b = (Open = Close)c20 = Doji1b// close when you get a long green candlelonggreencandle = (close - open) > .00050// close trade when stochastic has crossed// indicator25 = Stochastic[5,3](close)// indicator26 = Average[3](indicator25)// revdirection = (indicator25 CROSSES OVER indicator26)// close when you get a loose Doji// Doji3 = Range > ABS(Open - Close) * 1.2// c10 = Doji3IF SHORTONMARKET AND (c20 OR longgreencandle) THENBUY AT MARKETENDIF//************************************************************************//trailing stop functiontrailingstart = 10 //trailing will start @trailinstart points profittrailingstep = 10 //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//************************************************************************// Stops and targetsSET STOP pLOSS 7SET TARGET pPROFIT 401 user thanked author for this post.
03/08/2017 at 8:48 AM #27684Hi, thanks a lot for your contribution to the website. I moved your library’s post to the forum to discuss about your strategy. Did you try to backtest the strategy a bit longer in the past? Seems that your result is only from February this year, I think it’s too short to validate it.
Backtests for a longer period with or without spread or tick/tick tests are not given any good results, I’m sorry 🙁
I hope this will not discourage you from continuing to look for other ways to get better results! Good luck 🙂
03/08/2017 at 9:12 AM #27689It’s profitable going back to Feb 2015, when increasing the stop to 10 and the profit target to 45 – increases the gain slightly. The earlier trades are not as profitable as more recent trades. Seems to work better in the Trump era!
03/08/2017 at 10:16 AM #27711Im going to have another go at this. I have just read your post on ‘equity curve fitting’ and have just seen another code that can exclude trading around holidays. I feel a few more ‘IF’ statements are required!
03/29/2017 at 10:42 PM #30254Hi SCT
I can’t get your Bot to trade even once on EURUSD @ 15M over 100,000 Units.
I’ve also tried 1M, 5M, 1H 4H and Daily … weird eh?
Can you think of any reason please?
It’s probably something daft, but I can’t think, I’ll sleep on it! 🙂
GraHal
03/30/2017 at 9:55 AM #30288A lot of codes are referring to pips conditions like this one:
1c7 = (indicator7 > -0.00016)To be more “universal” with all EURUSD contracts from different broker, all of these lines should be coded like this instead:
1c7 = (indicator7 > -16*pipsize)2 users thanked author for this post.
03/30/2017 at 1:03 PM #30345Thank You Nicolas, I need to remember that one for next time, I need to remember that one …. etc 🙂
Attached the System with conditions changed to pipsize / pointsize. I used pip first then point and gave same result over 100,000 x 15M.
I also double checked using site below that I had made the changes correctly compared to sincitytrader original code.
There’s a lot of code in the System I’m sure it can be made to give better results?
GraHal
-
AuthorPosts
Find exclusive trading pro-tools on