Range of the last 60 day

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19240 quote
    ChrisI
    Participant
    New

    Hello

    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?

    Thank for the help

    #19328 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    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:

    // 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)
    
    return maxrangeday as "daily range", maxrange60 as "biggest range last 60 days"
    #19448 quote
    ChrisI
    Participant
    New

    Thanks a lot. This is what I´m searching for.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Range of the last 60 day


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
ChrisI @chrisi Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by ChrisI
9 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/28/2016
Status: Active
Attachments: No files
Logo Logo
Loading...