We would like to:
find if the highest high occurred on the 1st or 10th bar (i.e. in the first or tenth minute).
if the highest high occurred on bar 1, use the second highest high (providing it does not occur on the 10th bar). If the second highest high occurred on the 10th bar, use the 3rd highest high.
if the highest high occurred on bar 10, use the second highest high (providing it does not occur on 1st bar). If the second highest high occurred on the 1st bar, use the 3rd highest high.
if the highest high occur in bar 2 to 9 then use that as the highest high.
repeat above for finding lowest low.
what is the best way to do the above: arrays or elc list/maps?
And if using ELC what is the best approach to use for this?
Using ELC list and maps:
Code: Select all
variables:
min_low(0),
min_high(0),
min_bar_count(0);
//create bar counter that increments on date change from 1 to 10
if date <> date[1] then begin
min_bar_count = 1;
end;
if date = date[1] and min_bar_count >= 1 and min_bar_count <= 9 then begin
min_bar_count = min_bar_count[1] + 1;
//min_bar_count += 1;
end;
//reset counter to zero after bar10
if date = date[1] and min_bar_count[1] = 10 then begin
min_bar_count = 0;
end;
Code: Select all
vars: min_bar_high(MapNN.New), min_bar_low(MapNN.New);
vars: list_high(ListN.New), list_Low(ListN.New);;
value1 =ListN.PushBack(list_high, high);
value1 =ListN.PushBack(list_low, low);
value1 =ListN.Sort(list_high, false);
value1 =ListN.Sort(list_low, true);
many thanks for advice/help with this.