Hi, I wrote a code which works on back test and shows an entry for today, but it did not trigger in the live environment. It has worked previously so not sure what is wrong.
Also, I am unsure if the stop to break even code is correctly working. For example, today it rose +13 and then fell back. The stop to break even code should have kept +6 points.
Any ideas if something looks wrong in this code?
Thanks for the help.
Market = FTSE100 on 1 hour time frame.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
Once LastTradeDate = 0
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 090000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 160000
timeEnterAfter = time < noEntryAfterTime
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
//how much pips/points in gain to activate the breakeven function?
startBreakeven = 11
//how much pips/points to keep in profit above or below our entry price when the breakeven is activated (beware of spread)
PointsToKeep = 6
// Conditions to enter long positions
indicator1 = RSI[7](close)
c1 = (indicator1 >= 83)
ignored, ignored, ignored, ignored, indicator2, ignored, ignored = CALL "WA Explosion COMBO"[150, 30, 15, 15]
c2 = (indicator2 >= 260)
indicator3 = ExponentialAverage[5](close)
indicator4 = ExponentialAverage[17](close)
c3 = (indicator3 > indicator4)
indicator5 = ExponentialAverage[62](close)
indicator6 = ExponentialAverage[5](close)
c4 = (indicator5 < indicator6)
IF (c1 AND c2 AND c3 AND c4) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry AND LastTradeDate<>OpenDate THEN
BUY 1 CONTRACT AT MARKET
LastTradeDate = OpenDate
ENDIF
// Conditions to enter short positions
indicator7 = RSI[7](close)
c5 = (indicator7 <= 22)
ignored, ignored, ignored, ignored, ignored, indicator8, ignored = CALL "WA Explosion COMBO"[150, 30, 15, 15]
c6 = (indicator8 >= 260)
indicator9 = ExponentialAverage[5](close)
indicator10 = ExponentialAverage[17](close)
c7 = (indicator9 < indicator10)
indicator11 = ExponentialAverage[62](close)
indicator12 = ExponentialAverage[5](close)
c8 = (indicator11 > indicator12)
IF (c5 AND c6 AND c7 AND c8) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry AND LastTradeDate<>OpenDate THEN
SELLSHORT 1 CONTRACT AT MARKET
LastTradeDate = OpenDate
ENDIF
// Stops and targets
SET STOP pLOSS 45
SET TARGET pPROFIT 30
//reset the breakevenLevel when no trade are on market
IF NOT ONMARKET THEN
breakevenLevel=0
ENDIF
// --- BUY SIDE ---
//test if the price have moved favourably of "startBreakeven" points already
IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
//calculate the breakevenLevel
breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
ENDIF
//place the new stop orders on market at breakevenLevel
IF breakevenLevel>0 THEN
SELL AT breakevenLevel STOP
ENDIF
// --- end of BUY SIDE ---
// --- SELL SIDE ---
IF SHORTONMARKET AND tradeprice(1)-close >= startBreakeven*pipsize THEN
//calculate the breakevenLevel
breakevenLevel = tradeprice(1)-PointsToKeep*pipsize
ENDIF
//place the new stop orders on market at breakevenLevel
IF breakevenLevel>0 THEN
EXITSHORT AT breakevenLevel STOP
ENDIF
// --- end of SELL SIDE ---
Your topic is about a strategy so I have moved it to the ProOrder forum – which is for strategies. You posted in the ProBuilder forum which is for indicators. Please try to post in the correct forum with future topics. 🙂
Vonasi … shhhh whisper … it’s still in the ProBuilder Forum! 🙂
Apart that we don’t know what is included in the “WA Explosion COMBO” indicator, I do not see any error in the code.
For the missed breakeven order, look at rejected orders list, the price could have been too close to the actual price due to slippage.
Thank you all. Ive deleted and re-activated again. See if it triggers.