Here is my solution
1' count the number of bars that compose the day
When done, then each time a day finished, look for the lowest and the highest price for the last number of bars that compose the day
Et voilà!
Martin
Code:
// return the high and low of the previous session day
Var:
Intrabarpersist Barcount (0),
Intrabarpersist CountStart (false),
intrabarpersist Counting (true),
Intrabarpersist BarNum (0),
Intrabarpersist Dayhigh (0),
Intrabarpersist Daylow (0);
// count the numbers of bars during a day
If counting = true then begin
if time = 1700 and countstart = false then begin
Barcount = 0;
countstart = True;
BarNum = Barnumber;
end;
If countstart = True and barnum <> Barnumber then begin
Barcount = barcount +1;
BarNum = Barnumber;
If time = 1700 then begin
Counting = false;
Print (Barcount:0:0);
end;
end;
end;
//counting as been done and I know how many bars compose my day
// Now, found the highest and the lowest price for the previous barcount bars.
// This operation is done only when the day as been terminated
If counting = false and time = 1700 then begin
Dayhigh = highest(high,Barcount);
DayLow = lowest(low, barcount);
Print ( dayhigh:5:5, " " , daylow:5:5);
end;