Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not being detected until refresh

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

    Strategy not being detected until refresh

    I have a strategy that changes my bar color if a criteria is met.

    But at times, the strategy would not be detected and the bar's color would not change in real time, only when I refresh the ninjascript on the chart. Again, this happens only sometimes, other times it detects it correctly.

    The strategy is for "On Bar Close". It uses Order Flow Delta, Volume and BarTimes (https://ninjatraderecosystem.com/use.../nt8-bartimes/)

    Any idea what the issue is?
    Last edited by Ousher; 01-07-2022, 10:16 AM.

    #2
    Hello Ousher,

    Thanks for your post.

    When running a strategy with Calculate mode OnBarClose, the strategy will only process logic at the close of each bar.

    If you would like to have the strategy calculate logic more frequently then you would need to use a Calculate mode of OnEachTick or OnPriceChange. If you use OnEachTick, the strategy will process logic for each incoming tick. OnPriceChange means the strategy would process logic for each change in price.

    See this help guide page for more information on Calculate: https://ninjatrader.com/support/help.../calculate.htm

    Ultimately, to understand why the script is behaving as it is, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition along with the time of that bar. Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.
    https://ninjatrader.com/support/foru...121#post791121

    Please let me know if I may further assist
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

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