// Spread 0,4 Points
// 3 hours
// Talos Trading
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.
DEFPARAM FLATBEFORE = 153000
// Cancel all pending orders and close all positions at the "FLATAFTER" time
DEFPARAM FLATAFTER = 220000
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 153000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 215500
timeEnterAfter = time < noEntryAfterTime
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Conditions to enter long positions
indicator = RSI[14](Open)
c1 = (indicator CROSSES OVER 24.5)
c2 = (indicator CROSSES OVER 24)
c3 = (indicator CROSSES OVER 23)
c4 = (indicator CROSSES OVER 22)
c5 = (indicator CROSSES OVER 21)
c6 = (indicator CROSSES OVER 21.5)
c7 = (indicator CROSSES OVER 23.5)
c8 = (indicator CROSSES OVER 22.5)
c9 = (indicator CROSSES OVER 29)
c10 = (indicator CROSSES OVER 28)
c11 = (indicator CROSSES OVER 27)
c12 = (indicator CROSSES OVER 26.5)
c13 = (indicator CROSSES OVER 26)
c14 = (indicator CROSSES OVER 25.5)
c15 = (indicator CROSSES OVER 20.5)
c16 = (indicator CROSSES OVER 20)
IF (c1 OR c2 OR c3 OR c4 OR c5 OR c6 OR c7 OR c8 OR c9 OR c10 OR c11 OR c12 OR c13 OR c14 OR c15 OR c16) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
BUY 15 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
indicator17 = RSI[14](close)
c17 = (indicator17 CROSSES UNDER 55)
indicator18 = Stochastic[14,3](close)
c18 = (indicator18 >= 90)
IF c17 OR c18 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
c22 = (indicator >= 82.5)
c23 = (indicator >= 83.5)
IF (c22 OR c23 OR c25) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
SELLSHORT 15 CONTRACT AT MARKET
ENDIF
// Conditions to exit short positions
indicator24 = Stochastic[14,3](close)
c24 = (indicator24 <= 20)
indicator25 = Stochastic[14,3](close)
c25 = (indicator25 >= 45)
IF c24 AND c25 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pTRAILING 4
SET TARGET pPROFIT 10
Hi, thanks for sharing that code, but could you give more details about it? How are the results?
Hi Nicolas, thanks a lot for a magical site.
I have attached the result.
Please let me know if you need some more info.
In fact, i’m not sure about the “SET STOP pTRAILING 4″, the behavior in backtests and real time might differ a lot. You should use one of the trailing stop code available in the website. 0.4 spread point, are you sure?