The highest bar of n day ago  [SOLVED]

Questions about MultiCharts and user contributed studies.
turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 times
Been thanked: 1 time

The highest bar of n day ago

Postby turbofib » 01 Aug 2022

hi, i want to know The highest bar of n day ago
which code can i use ? (I use chart intraday not daily)
Last edited by turbofib on 02 Aug 2022, edited 2 times in total.

MKKL
Posts: 8
Joined: 31 Dec 2018
Has thanked: 2 times

Re: The highest bar of n day ago

Postby MKKL » 02 Aug 2022

There is an internal function - Highest(price, length) you may use.

turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 times
Been thanked: 1 time

Re: The highest bar of n day ago

Postby turbofib » 02 Aug 2022

There is an internal function - Highest(price, length) you may use.
But i use chart intraday

User avatar
rrams
Posts: 128
Joined: 10 Feb 2011
Location: USA
Has thanked: 7 times
Been thanked: 70 times
Contact:

Re: The highest bar of n day ago  [SOLVED]

Postby rrams » 02 Aug 2022

If you only care about the number of days in terms of 24 hours and not the number of session start times, then you could do something like:

Code: Select all

input:N(1); // days ago var: BarsPerDay(0), HighestBarAgo(0); if BarType_ex=2 then BarsPerDay=1440/BarInterval // minute time frame else if BarType_ex=3 then BarsPerDay=24/BarInterval; // hourly chart if lastbaronchart and MaxBarsBack>N*BarsPerDay then begin HighestBarAgo=HighestBar(H, N*BarsPerDay); print(HighestBarAgo:0:0); // bars back not bar number end;
Probably there are better ways to do this.


Return to “MultiCharts”