I´m searching for a indicator-code, that shows me the bigest range of the last 60 days. I want to create a histogram that shows the daily range and than there is a line, that shows the bigest range of the last 60 days. If the histogram crosses the line it is clear, that we have the bigest range of the last 60 days. How can I create such a highest-high-range-indicator?
You don’t mention what timeframe your indicator is for, but as you talk about days only, I am going to assume you want a daily timeframe display. In this case the following simple code will do the trick. However, should you want to display smaller timeframes (hourly, minutes, xticks views) then this code won’t do it because looking back 60 days would require knowing how mnay candles there is in the day and that depends on the chosen timeframe, so coding something that works for all timeframes is a bit more complicated.
But again, if your need is just for daily timeframe, then this will do it:
1
2
3
4
5
6
7
8
// Only works on daily timeframe
// For smaller hourly or minutes timeframes, or x ticks views, the code would be more complicated
// because looking back 60 days wouldn't be the same as looking back 60 candles
maxrangeday=range
maxrange60=highest[60](range)
returnmaxrangedayas"daily range",maxrange60as"biggest range last 60 days"
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue