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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X