Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Brandon H.NinjaTrader Customer Service

    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 Rapine Heihei, 04-23-2024, 07:51 PM
      2 responses
      30 views
      0 likes
      Last Post Max238
      by Max238
       
      Started by Shansen, 08-30-2019, 10:18 PM
      24 responses
      943 views
      0 likes
      Last Post spwizard  
      Started by Max238, Today, 01:28 AM
      0 responses
      9 views
      0 likes
      Last Post Max238
      by Max238
       
      Started by rocketman7, Today, 01:00 AM
      0 responses
      4 views
      0 likes
      Last Post rocketman7  
      Started by wzgy0920, 04-20-2024, 06:09 PM
      2 responses
      28 views
      0 likes
      Last Post wzgy0920  
      Working...
      X