Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

ATM strategy delayed by 1 bar if executed within a bar

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

    ATM strategy delayed by 1 bar if executed within a bar

    I am working with an ATM strategy. It uses a 1 minute bar timeframe.

    The issue I'm running into may likely be due to this statement provided by the document for GetAtmStrategyMarketPosition():
    ​​​​​​
    Changes to positions will not be reflected till at least the next OnBarUpdate() event after an order fill.
    I'm looking for confirmation and for a work-around.

    An example of order execution:

    11:32:59 OnBarClose: Entry conditionals are met and the ATM strategy executes it's entry
    11:33:52 The ATM strategy take profit target executes
    11:33:59 OnBarClose: Entry conditionals are met but the ATM strategy does not execute. Almost as if GetAtmStrategyMarketPosition() didn't report it as executed
    11:34:59 OnBarClose: Entry conditionals are met and the ATM strategy executes it's entry

    Ideally, the trade would have closed during that entry bar and on the close of that bar, the entry is still met and a new ATM is entered being that the first one closed.
    If it didn't take an additional bar to enter, a larger profit could have been made - or more importantly a smaller loss.

    If the GetAtmStrategyMarketPosition() is the problem, is there a way to get around this delay? I want to only enter a new ATM if there are no working orders.

    Thanks.
    Last edited by brettcomardelle93; 08-18-2020, 12:04 PM.

    #2
    Welcome to the forums brettcomardelle93!

    Please note that ATM strategies are initiated from NinjaScript strategies. We can use the ATM strategy methods to "peek/poke" the ATM strategy, but the ATM strategy is actually run as a separate strategy. Thus, it may take a bar or a few ticks for the ATM strategy methods to register.

    We may suggest running the strategy with Calculate.OnEachTick or Calculate.OnPriceChange, running the strategy on a smaller time frame, or adding another data series to the strategy so the logic is processed intrabar, or more frequently.

    More information on working with Multi Time Frame scripts can be found here - https://ninjatrader.com/support/help...nstruments.htm

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by junkone, 04-21-2024, 07:17 AM
    10 responses
    148 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by tsantospinto, 04-12-2024, 07:04 PM
    6 responses
    100 views
    0 likes
    Last Post tsantospinto  
    Started by rocketman7, Today, 02:12 AM
    5 responses
    26 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by ZenCortexReal, Today, 08:54 AM
    0 responses
    1 view
    0 likes
    Last Post ZenCortexReal  
    Started by ZenCortexReal, Today, 08:52 AM
    0 responses
    0 views
    0 likes
    Last Post ZenCortexReal  
    Working...
    X