Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IntraBar Condition

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

    IntraBar Condition

    I need to make a condition for when the following is met.
    A candlestick should have a lower low than the previous one and then have a higher high than the previous one.

    I've tried the following code but it doesn't draw the signals for me correctly. Could you give me some ideas?

    bool signal = false;
    if (Low[0]<Low[1])
    {signal = true;}

    if (signal==true && High[0]>High[1])
    {Draw.ArrowDown(this, @"Signal " + CurrentBar, false, 0, High[0]+2, Brushes.Blue);}

    I need the signal to be drawn when the price goes down from low1 and then exceeds high1. The current candlestick may have made a higher high than high1 before dropping below low1.

    Thanks!


    #2
    Originally posted by NinjaTrader_BrandonH
    Hello manueldecastro,

    Thanks for your post.

    The condition you shared would correct to detect if the current Low price is less than the previous Low price.

    That would also be correct logic for checking if the current High price is greater than the previous High price.

    If the script has the Calculate mode set to Calculate.OnBarClose, the OnBarUpdate() logic will only process at the close of a bar.

    To have logic calculate intrabar, you could set the Calculate mode to Calculate.OnPriceChange or Calculate.OnEachTick.

    Calculate.OnPriceChange would have OnBarUpdate() logic process for each change in price. Calculate.OnEachTick would have OnBarUpdate() logic calculate for each incoming tick.

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

    To understand how your logic is behaving, debugging prints need to be added to the script. Add prints one line above the conditions that print out all the values being used in the condition along with the Time of the bar. Prints will appear in a New > NinjaScript Output window.

    See this NinjaTrader Support article for information about using Print() to understand the behavior of a script: https://support.ninjatrader.com/s/ar...nd-TraceOrders
    Hi Brandon,
    Im working OneachTick.

    Comment


      #3
      Gracias Brandon. solucioné el error usando otras condiciones. se puede cerrar el hilo

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by futurenow, 12-06-2021, 05:49 PM
      18 responses
      878 views
      0 likes
      Last Post dj0ntz
      by dj0ntz
       
      Started by nailz420, 05-14-2025, 09:14 AM
      1 response
      116 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by NinjaTrader_Brett, 05-12-2025, 03:19 PM
      0 responses
      520 views
      1 like
      Last Post NinjaTrader_Brett  
      Started by domjabs, 05-12-2025, 01:55 PM
      2 responses
      83 views
      0 likes
      Last Post domjabs
      by domjabs
       
      Started by Morning Cup Of Trades, 05-12-2025, 11:50 AM
      1 response
      121 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Working...
      X