Running a Volume Filter

Dear Group,

I am interested in running a filter on volume, wherein let’s say volume over last 30 days is greater than 1 L shares for each day. Mind it is not average volume but each day volume is greater than 1 L

for( i = 0; i < BarCount; i++ ) 
Filter = Volume [i} > 100000; 

Would this work??

You need to read
It is absolute must-read for EVERY AmiBroker user. Most of people need to re-read that a couple of times until they get “aha!” moment.

One conclusion that you would arrive after reading this part of manual is that you DO NOT NEED LOOPS.

Your code should be just one simple line:

Filter = Volume > 100000;

Nothing more. No loops.

If I’ve understood your question correctly then you want a filter that produces a true value if the volume has been greater than 100,000 in each of the past 30 periods. No need for using Loops.

You can use the Sum() function:

//Single Bar Volume > 100,000//
SBVF = Volume > 100000;

//Volume > 100000 for each of past 30 days//
VFilt = Sum(SBVF,30) == 30;

I hope that helps.


Indeed that’s a logical way around

@BTW Welcome to the community :slight_smile: (it was your first post on this forum) and thank you for helping @pushkan and providing him with the best solution.