strategy entries not being executed

Viewing 15 posts - 1 through 15 (of 33 total)
  • Author
    Posts
  • #260452 quote
    LivJoJade
    Participant
    Junior

    Good evening all.


    I – along with a great deal of help – have written this script which I have prepared for automated trading, for some reason the IG platform is not executing the trades even though the acknowledgement is shown on my platform.


    The script is attached, as always many thanks in advance.

    EURO-INDEX-STRATEGY.itf
    #260453 quote
    GraHal
    Participant
    Master

    You are better posting the code direct on here using the </> at the far right of the toolbar above.

    Reason, the coding wizards on here can see your code, but they may not wish to download the .itf file.


    LivJoJade wrote: even though the acknowledgement is shown on my platform.

    Can you post a screenshot of what you mean by ‘the acknowledgement’ i.e. can you show us the acknowledgement?

    LivJoJade thanked this post
    #260454 quote
    LivJoJade
    Participant
    Junior

    Really, in the past I have been advised to provide the .itf file, I’m happy to copy and paste the script but cant find the </> facility to do so, does one have to do that?

    #260456 quote
    Iván González
    Moderator
    Master

    You can see in the screenshot how to share the code.

    By the way, the code you shared isn’t editable, so I can’t see it 🙂

    LivJoJade thanked this post
    Captura-de-pantalla-2026-04-23-080611.png Captura-de-pantalla-2026-04-23-080611.png
    #260473 quote
    LivJoJade
    Participant
    Junior

    good evening gentlemen, many thanks for taking the time to reach out.


    The screenshots show that the strategy script entered a trade at the close of the 08:00 bar this morning, however the autotrading did not trigger.


    I have attached an editable script of the strategy but will paste the script just to ensure its availability.


    Appreciate your help with this guys.



    DEFPARAM CumulateOrders = False
    DEFPARAM PreLoadBars = 3000
    
    
    //====================================
    // HS EURO MARKETS MASTER
    //====================================
    
    
    //-------------------------------------
    // SESSION FILTER (ADDED)
    //-------------------------------------
    tradeStart = 070000
    tradeEnd   = 213000
    inSession = time >= tradeStart AND time <= tradeEnd
    
    
    
    
    //====================================
    // CORE INDICATORS
    //====================================
    ema21 = ExponentialAverage[21](close)
    ema100 = ExponentialAverage[100](close)
    ema450 = ExponentialAverage[450](close)
    
    
    atr = AverageTrueRange[14](close)
    
    
    IF atr <= 0 THEN
    atr = 0.00001
    ENDIF
    
    
    avgATR = Average[20](atr)
    
    
    emaSpread = ABS(ema21 - ema100)
    trendStrength = emaSpread / atr
    
    
    
    
    //====================================
    // LONG GRADE SCORE
    //====================================
    gradeScore = 0
    
    
    IF close > ema21 THEN
    gradeScore = gradeScore + 1
    ENDIF
    
    
    IF ema21 > ema100 THEN
    gradeScore = gradeScore + 1
    ENDIF
    
    
    IF ema100 > ema450 THEN
    gradeScore = gradeScore + 1
    ENDIF
    
    
    IF close > high[1] THEN
    gradeScore = gradeScore + 1
    ENDIF
    
    
    
    
    //====================================
    // SHORT GRADE SCORE
    //====================================
    shortGradeScore = 0
    
    
    IF close < ema21 THEN
    shortGradeScore = shortGradeScore + 1
    ENDIF
    
    
    IF ema21 < ema100 THEN
    shortGradeScore = shortGradeScore + 1
    ENDIF
    
    
    IF ema100 < ema450 THEN
    shortGradeScore = shortGradeScore + 1
    ENDIF
    
    
    IF close < low[1] THEN
    shortGradeScore = shortGradeScore + 1
    ENDIF
    
    
    
    
    //====================================
    // TRADE MODE
    //====================================
    regime = 2
    
    
    IF trendStrength > 1.0 THEN
    regime = 1
    ENDIF
    
    
    
    
    //====================================
    // BULL DOMINANCE ENGINE
    //====================================
    macroBull = 0
    structureBreakUp = 0
    volExpansionBull = 0
    bullRegime = 0
    
    
    IF ema21 > ema100 THEN
    IF ema100 > ema450 THEN
    IF ema450 > ema450[20] THEN
    macroBull = 1
    ENDIF
    ENDIF
    ENDIF
    
    
    IF close > Highest[10](high)[1] THEN
    structureBreakUp = 1
    ENDIF
    
    
    IF atr > avgATR THEN
    volExpansionBull = 1
    ENDIF
    
    
    IF macroBull = 1 AND structureBreakUp = 1 AND volExpansionBull = 1 THEN
    bullRegime = 1
    ENDIF
    
    
    
    
    //====================================
    // BEAR DOMINANCE ENGINE
    //====================================
    macroBear = 0
    structureBreak = 0
    volExpansion = 0
    bearRegime = 0
    
    
    IF ema21 < ema100 THEN
    IF ema100 < ema450 THEN
    IF ema450 < ema450[20] THEN
    macroBear = 1
    ENDIF
    ENDIF
    ENDIF
    
    
    IF close < Lowest[10](low)[1] THEN
    structureBreak = 1
    ENDIF
    
    
    IF atr > avgATR THEN
    volExpansion = 1
    ENDIF
    
    
    IF macroBear = 1 AND structureBreak = 1 AND volExpansion = 1 THEN
    bearRegime = 1
    ENDIF
    
    
    
    
    //====================================
    // MASTER MARKET STATE
    //====================================
    marketState = 0
    
    
    IF bullRegime = 1 THEN
    marketState = 1
    ENDIF
    
    
    IF bearRegime = 1 THEN
    marketState = -1
    ENDIF
    
    
    
    
    //====================================
    // RESET FLAGS
    //====================================
    momentumEntry = 0
    defensiveEntry = 0
    shortMomentumEntry = 0
    shortDefensiveEntry = 0
    
    
    
    
    //====================================
    // LONG ENTRY ENGINE
    //====================================
    IF regime = 1 AND gradeScore >= 3 AND close > high[1] THEN
    momentumEntry = 1
    ENDIF
    
    
    IF regime = 2 AND gradeScore >= 3 THEN
    IF low <= ema21 AND close > open AND close > high[1] THEN
    defensiveEntry = 1
    ENDIF
    ENDIF
    
    
    
    
    //====================================
    // SHORT ENTRY ENGINE
    //====================================
    IF bearRegime = 1 THEN
    
    
    IF regime = 1 AND shortGradeScore >= 3 AND close < low[1] THEN
    shortMomentumEntry = 1
    ENDIF
    
    
    IF regime = 2 AND shortGradeScore >= 3 THEN
    IF high >= ema21 AND close < open AND close < low[1] THEN
    shortDefensiveEntry = 1
    ENDIF
    ENDIF
    
    
    ENDIF
    
    
    
    
    //====================================
    // REVERSAL LOGIC
    //====================================
    IF ShortOnMarket AND marketState = 1 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    
    IF LongOnMarket AND marketState = -1 THEN
    SELL AT MARKET
    ENDIF
    
    
    
    
    //====================================
    // ENTRY EXECUTION (MODIFIED)
    //====================================
    IF NOT ONMARKET AND inSession THEN
    
    
    IF momentumEntry = 1 OR defensiveEntry = 1 THEN
    BUY 1 CONTRACT AT MARKET
    direction = 1
    
    
    IF regime = 1 THEN
    tradeMode = 1
    trailingStop = close - atr * 2.8
    ELSE
    tradeMode = 2
    trailingStop = close - atr * 1.8
    ENDIF
    ENDIF
    
    
    IF shortMomentumEntry = 1 OR shortDefensiveEntry = 1 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    direction = -1
    
    
    IF regime = 1 THEN
    tradeMode = 1
    trailingStop = close + atr * 2.8
    ELSE
    tradeMode = 2
    trailingStop = close + atr * 1.8
    ENDIF
    ENDIF
    
    
    ENDIF
    
    
    
    
    //====================================
    // EXIT MANAGEMENT (UNCHANGED)
    //====================================
    IF ONMARKET THEN
    
    
    IF direction = 1 THEN
    
    
    IF tradeMode = 1 THEN
    newTrail = close - atr * 2.8
    ELSE
    newTrail = close - atr * 1.8
    ENDIF
    
    
    IF newTrail > trailingStop THEN
    trailingStop = newTrail
    ENDIF
    
    
    SELL AT trailingStop STOP
    
    
    ENDIF
    
    
    IF direction = -1 THEN
    
    
    IF tradeMode = 1 THEN
    newTrail = close + atr * 2.8
    ELSE
    newTrail = close + atr * 1.8
    ENDIF
    
    
    IF newTrail < trailingStop THEN
    trailingStop = newTrail
    ENDIF
    
    
    EXITSHORT AT trailingStop STOP
    
    
    ENDIF
    
    
    ENDIF
    
    
    EURO-INDEX-STRATEGY-1.itf
    #260478 quote
    LivJoJade
    Participant
    Junior
    #260483 quote
    GraHal
    Participant
    Master


    LivJoJade wrote: however the autotrading did not trigger.

    Is above a recurring problem?

    Is the Algo Timeframe 1 Hour?

    Have you checked your Order List / Closed Trades as might it be opening and closing on the same 1 Hour bar and so you will not see a position on a Chart.

    It can be referred to as ‘zero bars’, but you should see trades with 0 bars in your Order List?

    Hope that makes sense?

    LivJoJade thanked this post
    #260484 quote
    LivJoJade
    Participant
    Junior

    Is above a recurring problem?


    it has not triggered one entry despite the trades triggering in the backtest facility


    Is the Algo Timeframe 1 Hour?


    it is 1hr yes


    Have you checked your Order List / Closed Trades as might it be opening and closing on the same 1 Hour bar and so you will not see a position on a Chart.


    The script is to buy at market on bar close, I don’t think think it can open and close on the same bar


    It can be referred to as ‘zero bars’, but you should see trades with 0 bars in your Order List?


    No trades

    GraHal thanked this post
    #260485 quote
    GraHal
    Participant
    Master

    Aha, I woke with a better idea … are you sure your position size is >= minimum for the Instrument you are trading in real live?

    It can, at times, be that a size works on backtest but will not work on real live trading.

    Another possibility … are you 100% certain you selected exact same Instrument on real live as on backtest?

    LivJoJade thanked this post
    #260486 quote
    GraHal
    Participant
    Master


    LivJoJade wrote: The script is to buy at market on bar close, I don’t think think it can open and close on the same bar

    Just for info: The code runs on bar close, but the Buy / Sell occurs at at the Open of the next bar (milliseconds after code execution).

    LivJoJade thanked this post
    #260487 quote
    GraHal
    Participant
    Master

    I set your code (after opti) running on my Demo Platform last night and it has taken a trade on US30 on M2 Timeframe.

    So at least you know your code works in real Live.

    I will set your code running (no changes) on H1 TF on Demo real live … what Instrument are you trying on and getting no trades?

    LivJoJade thanked this post
    #260488 quote
    PeterSt
    Participant
    Master


    GraHal wrote: I set your code (after opti) running on my Demo Platform last night and it has taken a trade on US30 on M2 Timeframe. So at least you know your code works in real Live.

    Are you trying to obfuscate an already confusing thread ?


    I will set your code running (no changes) on H1 TF on Demo real live

    Or did you invent a new dimension in V13 ?


    • No system running in Demo will run by any guarantee on Live.
    • LivJoJade may run his system in Real Live or in Demo; he didn’t tell as far as I can see.
    • Demo Instruments are a mess (Sept. 2025 thing);
    • Live Instruments are also a mess (Sept. 2025 thing).
    • Both two above are even personal (we learned that from the Sept. 2025 thing) (what works for you may not work for me).


    But it is not said at all that this is LivJoJade’s culprit.


    #260489 quote
    PeterSt
    Participant
    Master
    IF momentumEntry = 1 OR defensiveEntry = 1 THEN
    BUY 1 CONTRACT AT MARKET
    direction = 1
    
    
    IF regime = 1 THEN
    tradeMode = 1
    trailingStop = close - atr * 2.8
    ELSE
    tradeMode = 2
    trailingStop = close - atr * 1.8
    ENDIF
    ENDIF
    
    
    IF shortMomentumEntry = 1 OR shortDefensiveEntry = 1 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    direction = -1
    
    
    IF regime = 1 THEN
    tradeMode = 1
    trailingStop = close + atr * 2.8
    ELSE
    tradeMode = 2
    trailingStop = close + atr * 1.8
    ENDIF
    ENDIF
    


    Your Entries for Long and Short are not mutually exclusive. Thus, within the one call of your code, it may go Long and Short at the same time and this cancels out. I said “may” and I am not claiming this is the culprit for real. But at least is is “bad coding”.

    Ask your AI to take this into account next time. 😉



    GraHal and LivJoJade thanked this post
    #260490 quote
    PeterSt
    Participant
    Master


    GraHal wrote: Another possibility … are you 100% certain you selected exact same Instrument on real live as on backtest?

    I had my coffee … You ?

    What does it even mean ?

    Hopefully for the better I would make this of it :


    Are you 100% certain you selected the exact same instrument on ProOrder as on Backtest ?

    But PeterSt’s answer would be : of course, how would you go about selecting a different instrument ? have a special chart with another instrument in it ?

    🙂


    A somewhat more relevant point could be :

    Have you selected the Instrument of your “target” so that it matches your minimum quantity ? Note : this is what GraHal asked too, but my question here is about not easily being able to see that you chose an e.g. 100 euro cash instrument instead of 1 euro. And in the former case

    • on Backtest this will work;
    • on Demo it depends but probably already not;
    • on Real Live this will definitely not work.


    GraHal and LivJoJade thanked this post
    #260537 quote
    LivJoJade
    Participant
    Junior

    i run the same script and observe 4 euro indice but predominately trade the DAX, on the US I run and observe 3 inidice and predominately trade US100 and DJIA. I have autotrade set up to trade just the DAX and DJIA as I’ve no desire to be overexposed, however there is zero chance of that with zero trades triggered. From the screenshot you can see the trades triggered on the backtest by the cyan bars which appear above the price charts.

    My £pp is above the minimum required by IG.

    I am attempting to run the script in live trading.

    And yes, I have engaged with AI to create this script, I have very limited knowledge of coding so am very grateful for any help. I’m much obliged to you both.


    Screenshot-2026-04-24-175201.png Screenshot-2026-04-24-175201.png
Viewing 15 posts - 1 through 15 (of 33 total)
  • You must be logged in to reply to this topic.

strategy entries not being executed


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
LivJoJade @livjojade Participant
Summary

This topic contains 32 replies,
has 4 voices, and was last updated by LivJoJade
1 week ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/22/2026
Status: Active
Attachments: 19 files
Logo Logo
Loading...