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

How to obtain the highest and lowest price values within a specific period of bars

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

    How to obtain the highest and lowest price values within a specific period of bars

    Hi,
    I am trying to add an automatic fibonacci module to my auto strategy.

    For this reason I want to code the fibonacci formula inside my strategy in order to be able to draw the retracement lines dynamicall based on swing highs and lows.

    In this regard, I want to ask on what the best way it would be to get the highest and lowest price values within a certain amount of bars. I plan on adding a variable on the lookback period in order to be able to optimize.

    Shall I use the High[10] ...and will it take the highest bar over the period of the last 10 bars, or it will take the highest value of a single bar that is 10 bars back from the current one?

    or shall I use the HighestBar(DefaultInput, 0) where I change the "0" with the lookback period?

    I guess my question is, if I change the lookback period ...which function will actually return me the highest point for that whole lookback period.

    And same goes for the lowest point.

    Once I have those, I will be able to create my automatic fibonacci levels.

    Thanks.

    #2
    nikolaalx, you could use HighestBar and pass that index into your High series, however the MAX would be directly accomplishing that by returning you the maximum value of the series passed in over the look back period, same would exist for lowest value with MIN.

    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ClarkInnissy, Today, 11:27 PM
    0 responses
    1 view
    0 likes
    Last Post ClarkInnissy  
    Started by ETFVoyageur, Today, 08:42 PM
    0 responses
    13 views
    0 likes
    Last Post ETFVoyageur  
    Started by kaseipds, Today, 06:15 AM
    3 responses
    47 views
    0 likes
    Last Post NinjaTrader_Eduardo  
    Started by ZimmeMark, Today, 05:09 PM
    0 responses
    24 views
    0 likes
    Last Post ZimmeMark  
    Started by ETFVoyageur, Today, 05:02 PM
    0 responses
    7 views
    0 likes
    Last Post ETFVoyageur  
    Working...
    X