Forums › ProRealTime English forum › ProOrder support › [beta-testing] multi timeframe support for automatic trading, ideas are welcome! › Reply To: [beta-testing] multi timeframe support for automatic trading, ideas are welcome!
07/22/2018 at 3:13 PM
#76468
I did not have the opportunity to test this code as i do not have access to MTF with IG now.
But, this is a piece of code i would try to improve when I can.
It is only buy at the moment. You can make it run on EURUSD M1 to test it.. maybe it will be very bad i do not know.
The idea in the future would be to improve the MM and the exit method (Entry in M1 but manage a breakeven in M1 + exit in M5 or M15…).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
// Définition DEFPARAM CumulateOrders = False DEFPARAM FLATBEFORE = 090000 DEFPARAM FLATAFTER = 120000 TIMEFRAME(5 minutes) haclose=(open+close+low+high)/4 haopen=(haopen[1]+haclose[1])/2 sto = Stochastic[5,3](close) bull5=(haclose>haopen) and (sto>sto[1]) and (sto<80) TIMEFRAME(15 minutes) haclose=(open+close+low+high)/4 haopen=(haopen[1]+haclose[1])/2 sto = Stochastic[5,3](close) bull15=(haclose>haopen) and (sto>sto[1]) and (sto<80) TIMEFRAME(default) haclose=(open+close+low+high)/4 haopen=(haopen[1]+haclose[1])/2 sto = Stochastic[5,3](close) Average=Average[3] Signal= (haclose>haopen) and (sto>sto[1]) and (sto<80) and sto CROSSES OVER average) if bull5 and bull15 and signal then buy at market endif // Close position TIMEFRAME(default) sto = Stochastic[5,3](close) IF sto CROSSES OVER 80 THEN SELL AT MARKET ENDIF // Stops SET STOP pLOSS 15 |