Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Understanding Backtest in NT7

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

    Understanding Backtest in NT7

    Hi,

    I want to understand why when I do open a position, the order is filled one bar after the current bar in my backtest?

    Please see the image below. I opened a position on first tick after the bullish pattern, but the position was opened actually at the beginning of the next bar.

    My backtest is showing that I lost in that trade. But actually should be a winning trade cuz I opened my position too many pips below.

    This happen to me in all trades in my backtest, so I can't trust my backtest.

    Click image for larger version

Name:	WhyBoughtOneBarAfter.PNG
Views:	1
Size:	19.3 KB
ID:	905202

    Is it something wrong?

    I also tried to do a tick based backtest adding this on my initialise method

    Code:
    Add(PeriodType.Tick, 1);
    And this at the beginning of my OnBarUpdate method

    Code:
    if (BarsInProgress != 0)
                    return;
    And even doing that, my backtest is not working as it's supposed to work.

    I have tick data that I downloaded from FXCM using NT7 Historical Data Manager

    Any help will be appreciated
    Thank you very much.

    #2
    Hello daniel_boteroc4,

    Thank you for your post.

    In backtesting the calculations are performed on the close of the bar and then the order is submitted to the following bar. You can find more details on the difference between real-time and historical backtesting at the following link: http://ninjatrader.com/support/helpG...ime_vs_bac.htm

    For the added series of 1 tick you would also and the backtest not taking any trades you would want to look in the following links.
    First is the information on multiple series in your script: http://ninjatrader.com/support/helpG...nstruments.htm
    Second is the sample on adding intra bar granularity for fills using an added series: http://ninjatrader.com/support/forum...ead.php?t=6652

    Comment


      #3
      Hi,

      Thanks for your answer.

      I read this post where NinjaTrader_Josh said that you can simulate a tick-based backtest.

      You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


      You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building.
      I downloaded the attached files and I did write my code the same way but actually the order is executed in primary bars and not in secondary bars which is what I want to do.

      Could you help me please?

      Comment


        #4
        Hello daniel_boteroc4,

        Thank you for your response.

        Are you using the BarsInProgress index in your order method?
        For example:
        Code:
        [I]EnterLong([/I][B]1[/B][I], 1, "Enter on Secondary Series");[/I]

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by TraderBCL, Today, 04:38 AM
        2 responses
        17 views
        0 likes
        Last Post TraderBCL  
        Started by martin70, 03-24-2023, 04:58 AM
        14 responses
        106 views
        0 likes
        Last Post martin70  
        Started by Radano, 06-10-2021, 01:40 AM
        19 responses
        609 views
        0 likes
        Last Post Radano
        by Radano
         
        Started by KenneGaray, Today, 03:48 AM
        0 responses
        5 views
        0 likes
        Last Post KenneGaray  
        Started by thanajo, 05-04-2021, 02:11 AM
        4 responses
        471 views
        0 likes
        Last Post tradingnasdaqprueba  
        Working...
        X