Adding Date Conditions to Highest(n) & Lowest(n)

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #13791 quote
    liammaher11
    Participant
    New

    Hi

    Is it possible to add a date function into the highest & lowest code? To add a highest or lowest indicator between two sets of dates without defining the dates.

     

    For example:

    Pulling the highest high from an hourly chart for a 7 day period. Something like, highest(t)-(t-7), to pull the highest high between 27th sept (t) and 20th sept (t-7).

     

    The reason I am looking down this avenue is because I was using an hourly multiple to indicate daily levels, however this becomes a problem when the highest or lowest prices fall near the back end of the time frame, as the number of hours it would need to look at to capture “daily” levels would need to increase by 1 every hour. So if it used 115 hours of prices to capture 7 days of data, this would need to increase by 1 every hour in order to keep the full days pricing data.

     

    Any advice or solution would be greatly received.

     

    Many Thanks

     

    Liam

    #13825 quote
    Nicolas
    Keymaster
    Master

    Why are you looking specifically to the hourly chart to catch the highest and lowest prices between 2 dates?

    #13833 quote
    liammaher11
    Participant
    New

    Hi Nicolas,

     

    To add levels derived from daily numbers to an hourly candle chart

     

    Many Thanks

    #13834 quote
    Nicolas
    Keymaster
    Master

    So you are looking for daily high and low between 2 dates and show them on an hourly timeframe?

    (sorry for questions, I’m like a doctor, I want to give you the right treatment)😄

    #13835 quote
    liammaher11
    Participant
    New

     

    No prob at all!

    looking more for the highest high & lowest low between 2 dates and show them on hourly timeframe

    #13853 quote
    Nicolas
    Keymaster
    Master

    Ok! So you don’t need to spot them on an hourly chart specifically, you can use OHLC of daily timeframe for that!

    Because the highest high of an hourly chart is exactly the same as the high of a day.

    So, you can code it like this:

     

    //store the highest high and lowest low during 7 days and then reset
    if day<>day[1] then
     count = count +1
    endif
    
    if count=8 then
     count = 0
     hh = close
     ll = close
    endif
    
    hh= max(hh,high)
    ll= min(ll,low)
    
    RETURN hh,ll
    #13856 quote
    liammaher11
    Participant
    New

    Thanks very much Nicolas, will try this out

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

Adding Date Conditions to Highest(n) & Lowest(n)


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by liammaher11
9 years, 4 months ago.

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