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 Tim-c, Today, 03:54 AM
    0 responses
    3 views
    0 likes
    Last Post Tim-c
    by Tim-c
     
    Started by FrancisMorro, Today, 03:24 AM
    0 responses
    2 views
    0 likes
    Last Post FrancisMorro  
    Started by Segwin, 05-07-2018, 02:15 PM
    10 responses
    1,771 views
    0 likes
    Last Post Leafcutter  
    Started by Rapine Heihei, 04-23-2024, 07:51 PM
    2 responses
    31 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by Shansen, 08-30-2019, 10:18 PM
    24 responses
    945 views
    0 likes
    Last Post spwizard  
    Working...
    X