Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-instrument issue

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

    Multi-instrument issue

    I have an indicator running in 15 seconds chart that draws a signal when conditions are met in primary Bars or in secondary Bars. It works perfecly OnBarClose.

    But I need the indicator run OnEachTick, and in this case, there are situations where signals of secondary series are duplicated, they appear in the bar where conditions are met and also in the next one.

    I suppose the problem is that primary bars have started and there is not a first tick in secondary yet, so the code takes last close bar data

    What would be a good approach to wait that secondary bar starts?

    Thanks a lot
    Last edited by Impeesa; 10-07-2020, 01:40 AM.

    #2
    Hello Impeesa,

    Thanks for your post.

    When using Calculate.OnEachTick, or Calculate.OnPriceChange, you can use IsFirstTickofBar if you want to have some processes performed only once per bar.

    Reference: https://ninjatrader.com/support/help...ttickofbar.htm

    I do not know if this will solve the issue but wanted to let you know that is something available.

    Otherwise, you may need to create logic (in the form a bool variable) where the bool is set when the condition to draw the object is true and then once drawn is set to false to prevent drawing again until some other condition resets the bool back to true when you are ready to draw again.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    77 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X