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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X