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

Strategy Enter Order timing in backtest

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

    Strategy Enter Order timing in backtest

    Good evening,
    I need to verify what I am seeing in backtesting/historical market replay and it's limits on COBC.

    I have a strategy that uses a modified swing indicator with a strength, say, set to 5. I am also using another indicator which calculates only on the current bar.

    If my conditions are true for my modified swing AND my other indicator, I am testing EnterLong/EnterShort.

    What I'm seeing on the chart is that the order isn't placed until 2 bars after the last bar of the modified swing. So if swing had strength=5, then the order is placed on bar (7). This is true regardless of value of COBC.

    So far I've found this to be expected in Backtesting/Market Replay and that only live will allow for intrabar?

    If this is true, then for live would I then use FrrstTickofBar?

    I just need to verify what I have so far is as much as I can expect for backtesting and isn't a way to have the order show on the next bar after swing check.

    Thanks

    #2
    Hello Cookwp,

    Thank you for your post.

    Yes, this is expected behavior with the backtest. The reason for this is cause the CalculateOnBarClose is set to True always with the backtest. We only know the given values of the bars historically and not the intrabar data.

    For live you can use the FirstTickOfBar for your calculations that you are trying to get.

    You can also use an Intrabar granularity system to have your backtest calculate on an intrabar system -
    http://www.ninjatrader.com/support/f...ead.php?t=6652
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thank you. And is it true that the same would be expected from Market Replay as well? I do have calculations using FirstTickOfBar working. Just want to verify that unless I'm doing real-time trading, I will not be able to see the actual Order until a bar later, either through backtest or Market Replay. All I could do is perform some output or draw something on the bar to indicate it 'would' have happened, correct?

      Comment


        #4
        Cookwp,

        Correct. The strategy is waiting for the bar to close before submitting any orders and why you are seeing the execution on the next bar.
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by knowmad, Yesterday, 03:52 AM
        3 responses
        42 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by MSerag, 05-06-2024, 11:52 PM
        5 responses
        26 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Aviram Y, Today, 06:03 AM
        0 responses
        1 view
        0 likes
        Last Post Aviram Y  
        Started by Skifree, Yesterday, 11:21 AM
        5 responses
        17 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by hanaewqydow, Today, 06:02 AM
        0 responses
        1 view
        0 likes
        Last Post hanaewqydow  
        Working...
        X