Code did not trigger in live environment

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #112124 quote
    adeelq79
    Participant
    Junior

    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 ---
    
    #112131 quote
    Vonasi
    Moderator
    Master

    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. 🙂

    #112185 quote
    GraHal
    Participant
    Master

    Vonasi … shhhh whisper … it’s still in the ProBuilder Forum! 🙂

    robertogozzi and Vonasi thanked this post
    #112203 quote
    Nicolas
    Keymaster
    Master

    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.

    #112239 quote
    adeelq79
    Participant
    Junior

    Thank you all. Ive deleted and re-activated again. See if it triggers.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Code did not trigger in live environment


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
adeelq79 @adeelq79 Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by adeelq79
6 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/04/2019
Status: Active
Attachments: No files
Logo Logo
Loading...