hi, i want to know The highest bar of n day ago
which code can i use ? (I use chart intraday not daily)
The highest bar of n day ago [SOLVED]
Re: The highest bar of n day ago
There is an internal function - Highest(price, length) you may use.
- 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]
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:
Probably there are better ways to do this.
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;