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