Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

line close

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

    line close

    Hello NinjaTrader family,

    How would I state bars 3, 2 had their highs above and lows less than a line but none of these bars were dependent on closing greater or lower than the previous bar? Meaning bar 2 just needs to have a close higher and close lower than a line but shouldn't mean close is greater or lower than previous bar. I can code 2 bars ago to close higher and lower than the line but I don't want the candle to be a specific color. I might still be confusing a lot of folks. The idea is to look for three candles that have their highs above a line and lows below a line but are not dependent on the close of the previous bar. So I can have three red bars meet this condition, 2green bars and 1 red, all green bars etc.

    Thank you
    Titli

    #2
    Hello Titli,

    Thanks for your post.

    I am not sure I understand exactly what you are wanting to accomplish.

    Are you wanting to detect if the High price and Low price of 2 bars ago are greater/less than an indicator plot (line)?

    You could reference the High price 2 bars ago by passing in a barsAgo value of 2 when calling High[barsAgo], such as High[2]. Similarly, a bars ago value of 2 could be passed into Low[barsAgo] to get the low price 2 bars ago, such as Low[2].

    To get the High price 1 bar ago, you could use High[1]. To get the Low price 1 bar ago, you could use Low[1]. To get the current High price and Low price, you could use a bars ago value of 0, such as High[0] and Low[0].

    These values could then be compared to an indicator or numerical value in your script.

    See the help guide pages below for more information.

    Low: https://ninjatrader.com/support/helpGuides/nt8/low.htm
    High: https://ninjatrader.com/support/helpGuides/nt8/high.htm

    Let me know if I may assist further.
    <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
    45 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 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