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

Backtesting with more intra-bar granular

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

    Backtesting with more intra-bar granular

    Hello,

    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


    I will be testing strategies on all timeframes (3 minutes up to 60 minutes) using NT7.

    I have read that Strategy Analyzer backtesting simulation only uses the OHLC data points. And if the stoploss and the profit target price is in the same bar, the simulation algorithm defaults to give that trade a loss for a more conservative back testing. The backtesting simulation does this because it does not know price direction for that bar and does not know if profit target comes before stop loss or vice versa.

    What is your recommendation for a more accurate back testing for this scenario?
    Will submitting orders to a secondary bar object for an intrabar fill help with this scenario? Or do I need to purchase tick data.

    I ask because I am back testing on the 30 min bar chart and I see some stop loss and profit target prices on the same bar and that trades defaults to a loss.

    Thank you

    #2
    Hello simple_goodoboy, and thank you for your question. Whenever a strategy relies on realtime events, such as ATM strategies, or in this case requires more involved Level 2 data and realistic bar calculations, I recommend using the Playback Connection (in NT7 this was called the Market Replay connection). You can learn more about this here,

    NT7: http://ninjatrader.com/support/helpG...ket_replay.htm
    NT8: http://ninjatrader.com/support/helpG...connection.htm

    This said, you can continue using the strategy analyzer and a secondary bars series. You will need to ensure you are passing a BarsInProgressIndex to all of your Entry and Exit methods. You will not be able to use SetProfitTarget and SetStopLoss, as these always place trades on your primary bars; instead you will need to use Exit methods to exit your positions. This limitation, and this re-writing of your strategy with the strategy analyzer in mind, is why I recommended using the playback connection, which will in turn not require any code changes.

    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cre8able, Today, 01:01 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by manitshah915, Today, 12:59 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by ursavent, Today, 12:54 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Mizzouman1, Today, 07:35 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by RubenCazorla, Today, 09:07 AM
    2 responses
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X