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

Entry at higher/lower than previous candle

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

    #16
    Hello Jim H.,

    Thank you for your reply.

    It's important to keep in mind that in a backtest, fills are determined based on 4 data points, OHLC of a bar since that is the only information that is known during a backtest and there will be no intra-bar data. This means actions cannot happen intra-bar, fills cannot happen intra-bar. All prices and actions come from and occur when the bar closes as this is all the information that is known.

    Because of this, OnBarUpdate will only update 'On bar close' as it does not have the intra-bar information necessary for 'On price change' or 'On each tick'.

    Also, here is a link to the differences on real-time vs backtest (historical).
    http://ninjatrader.com/support/helpG...ime_vs_bac.htm

    So if you're running the strategy on each tick on live data, any positions calculated in a backtest or on historical data on a chart will actually be calculated as if you were running the strategy On Bar Close instead of On Each Tick. That may be the source of the strategy appearing to not calculate as you'd expect if you're not actually looking at what it's doing when running it on live data.

    You can set up a crossover condition to check the previous bar and the one prior to it if you like, just set the bars ago for both the MACDs to 1:

    Click image for larger version

Name:	2021-02-09_08-50-14.png
Views:	192
Size:	48.3 KB
ID:	1140842

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    191 views
    0 likes
    Last Post Hasadafa  
    Started by GussJ, 03-04-2020, 03:11 PM
    11 responses
    3,230 views
    0 likes
    Last Post xiinteractive  
    Started by andrewtrades, Today, 04:57 PM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    7 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    441 views
    0 likes
    Last Post Delerium  
    Working...
    X