Finding out average bar length (H-L) or abs(C-O) for last 50 bars or 100 bars

Is there a way to calculate average bar length (H-L) or abs(C-O) for last 50 bars or 100 bars...

https://www.amibroker.com/guide/afl/ma.html

Check out MA function doing that

1 Like

Are you suggesting a=ma(c,50), b=ma(o,50) .. c=abs(a-b).. to calculate average of 50 bars(excluding wicks)... this will be correct ?.. it may not be as for some bars (a-b) will be positive and for some bars (a-b) will be negative.
Can you elaborate on your suggested approach.

a = MA(abs(Close-Open), 50);
1 Like

Thanks for your response.

@snbarma I was suggesting to do

average1 = MA(H-L, 50);

average2 = MA(abs(C-O), 50);