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 love2code2trade, 04-17-2024, 01:45 PM
      4 responses
      36 views
      0 likes
      Last Post love2code2trade  
      Started by alifarahani, Today, 09:40 AM
      2 responses
      12 views
      0 likes
      Last Post alifarahani  
      Started by junkone, Today, 11:37 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by pickmyonlineclass, Today, 12:23 PM
      0 responses
      1 view
      0 likes
      Last Post pickmyonlineclass  
      Started by frankthearm, Yesterday, 09:08 AM
      12 responses
      44 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Working...
      X