Need help for volume average

from this topic How to scan for stocks having current day volume greater than average of past few days?

AverageVolume = MA(Volume, 5);  is previous 5 days volume or include today volume

I would like to have formula
 Volume today/Volume average previous 5 days.

Can I use
VolumeRatio = Volume(today)/averageVolume(previous 5 days)

Thank you.

All functions (except Ref) INCLUDE current bar.

If you want past volume, you need to use Ref() function to reference past data.

That is pretty simple

VolumeRatio = Volume / Ref( MA( Volume, 5 ), -1 );

Recommended reading:
https://www.amibroker.com/guide/h_understandafl.html

1 Like

Thank you Tomasz
now script work correctly.
2022-11-16 06_39_21-AmiBroker - Analysis1
2022-11-16 06_41_00-AFL Formula Editor - MyExploration.afl

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.