Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue implementing ATM in a strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Issue implementing ATM in a strategy

    This is my first time trying to add an ATM to a strategy, and I'm running into the issue that the strategy isn't taking any trades. Before I added the ATM, I just used a regular market entry and stop loss on the condition builder, and it would take trades.

    I created the ATM template, and I believe I added it to the strategy. Anyways, here's the relevant section of the code:


    protected override void OnBarUpdate()
    {
    if (Historical)
    return;

    // Condition set 1
    if (Force_Index_v02("EMA", 13, "EMA", 13).FastLine[0] > Force_Index_v02("EMA", 13, "EMA", 13).FastLine[1]
    && EMA_Slope_Color(20, true)[0] > EMA_Slope_Color(20, true)[1]
    && EMA(5)[0] > EMA(5)[1]
    && EMA(5)[0] > EMA(5)[2]
    && Median[0] <= EMA(5)[0]
    && High[0] > EMA_Slope_Color(20, true)[0]
    && CrossAbove(EMA(5), EMA_Slope_Color(20, true), 5)
    && Force_Index_v02("EMA", 13, "EMA", 13).FastLineAbove[0] > 0)
    {
    AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0,
    TimeInForce.Day, GetAtmStrategyUniqueId(), "PERATM",
    GetAtmStrategyUniqueId());
    }
    }



    Note: PERATM is the name of the ATM template.

    #2
    Hello Jeddy197, how are you determining that the entry condition fired on realtime data? With this setup you would not see any backesting / historical trades, as the ATM methods could not offer that.
    Also: do you see any errors in the log tab running the script live?

    For a complete working example of a NinjaScript ATM please check into the SampleAtmStrategy shipped with NT.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X