On a chart with data1 being a 1 hour chart and data2 being a daily chart, I'm trying to reference previous bar values of a moving average from data2 but im not getting the right results. Ive included an indicator that shows the issue, i should be getting 5 distinct values for variable mavg, instead im getting just two. Any ideas where im going wrong?
Code: Select all
vars:
x(0),
mavg(0 data2);
mavg = Average( close , 5 ) data2;
if LastBarOnChart_s = true and barstatus(2) = 2 then begin
once for x = 0 to 4 begin
print("mavg :" , NumToStr(mavg[x] , 2));
end;
end;
Output results:
Code: Select all
mavg :3439.30
mavg :3441.70
mavg :3441.70
mavg :3441.70
mavg :3441.70