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

Conflicting Mutli-Bar Script Recommendations in Documentation

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

    Conflicting Mutli-Bar Script Recommendations in Documentation

    So I'm seeing two contradictory statements in the documentation, both from here (https://ninjatrader.com/support/help..._practices.htm). The first:

    3. For advanced order methods, if you DO NOT specify a BarsInProgress , the order will be submitted to the current bars in progress updating. If the current BarsInProgress is a higher time frame, this could delay the time that the order is filled during historical backtesting. As a result, you should always submit historical orders to the most granular of time frames.


    The second:

    1. Should you have multiple Bars objects of the same instrument while using Set() methods in your strategy, you should only submit orders for this instrument to the first Bars context of that instrument. This is to ensure your order logic is processed correctly and any necessary order amendments are done properly.
    The first suggests the only way to ensure realistic fills is to submit to the lowest timeframe. The second suggests that I may have issues with set stop loss and profit target if I submit to anything but the first bar series for the traded instrument.

    In my case I believe this is causing orders to trade through stop losses in the first bar of the trade. Specifically I have a script which trades on the 15m, and loads the 1m because the order of events is important. I'm entering with limit orders, so knowing which happened first, entering or hitting the stop, is critical to the accuracy of results. In the past I've had some luck using Exit methods (ExitLongLimit etc.) additional accuracy, but that shouldn't be necessary here. Is this a known bug, what's the work around?​

    #2
    Hello Jaggy,

    Advanced order methods are not the same as the Set methods. Set methods are SetStopLoss, SetTrailStop, SetProfitTarget. Advanced order methods are methods like EnterLongLimit, ExitLongLimit.

    When using Set methods if you have multiple timeframes of the same instrument for processing reasons you would need to submit those on the primary bars in progress, Set methods do not have a way to specify a BarsInProgress in their overload. Advanced methods do have a way to specify a bars in progress which the order would be submitted to.



    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse,

      Thank you for this information. I have been puzzling over this issue too. My single instrument script has primary plus three other time frames and I run Calculate on each tick. One time frame is more granular than the Primary. Am I correct to understand that if I avoid the Set methods and submit orders with the "barsInProgressIndex" they will execute on that (more granular) time frame regardless of the Primary Time Frame?

      Comment


        #4
        Hello JGRtrader,

        If you are using OnEachTick in realtime it wouldn't matter to submit the orders to a more granular series, the primary is processing on each tick already. The only scenario where that would be needed while using OnEachTick in realtime is if you are limiting the processing for example doing the action only on the first tick of the bar. If your logic can happen for any tick then the orders can be summited at tick granularity.

        For backtesting purposes yes that would help to submit the orders to the more granular series so the fills can be processed on that series.

        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by futtrader, 04-21-2024, 01:50 AM
        5 responses
        56 views
        0 likes
        Last Post NinjaTrader_Eduardo  
        Started by PeakTry, Today, 10:49 AM
        0 responses
        2 views
        0 likes
        Last Post PeakTry
        by PeakTry
         
        Started by llanqui, Today, 10:32 AM
        0 responses
        5 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by StockTrader88, 03-06-2021, 08:58 AM
        45 responses
        3,992 views
        3 likes
        Last Post johntraderuser2  
        Started by TAJTrades, Today, 09:46 AM
        0 responses
        8 views
        0 likes
        Last Post TAJTrades  
        Working...
        X