Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Struggling to create indicator that uses Highest and Lowest values

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

    Struggling to create indicator that uses Highest and Lowest values

    I'm trying to convert this indicator from Pinescript into ninja, I've tried to use High[HighestBar]/ Low[LowestBar] but it didn't give the same results

    length = input(20)
    // Calculate upper and lower bands
    upperBand = ta.highest(close, length)
    lowerBand = ta.lowest(low, length)

    //// calculate highest lowerBand for the last however many bars
    lb = ta.highest(lowerBand, length)

    ////////plot line
    plot(lb, color=color.white)​

    #2
    Hello AdithBlack,

    Thanks for your post.

    From my understanding, the ta.highest() function notes in the Pinescript documentation that this function returns that highest value for a certain number of bars back. The ta.lowest() function returns the lowest value for a certain number of bars back.

    In NinjaScript, you could use MAX() to get the highest value over the specified period. MIN() could be used to get the lowest value over the specified period.

    See the help guide documentation below for more information about these methods and sample code.

    MAX(): https://ninjatrader.com/support/help...aximum_max.htm
    MIN(): https://ninjatrader.com/support/help...inimum_min.htm

    AddPlot() would be used to add a plot to the script. Values could then be assigned to the plot using Value = x, where x is the value you want to assign to the plot.

    This help guide page contains more information about AddPlot() and sample code: https://ninjatrader.com/support/help...t8/addplot.htm

    Please 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


      #3
      Thanks! I got it now
      Last edited by AdithBlack; 02-02-2023, 04:46 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X