Exploration to find stocks were the Average volume over a period of 252 days should be > 30,00,000

Dear All AFL Experts,

I made an exploration to find stocks were the average volume over a period of 252 days should be > 30,00,000. When i run the code its giving me an error with an yellow line. Don't know were i went wrong.

//Exploration to find stocks were the Average volume over a period of 252 days should be > 30,00,000

AvgVol252 = HHV(Ref(C,-1),252);

HV = AvgVol252 > 30,00,000;

Filter = HV;

AddColumn(HV,"AvgVol",1.2);

I'm just a beginner just trying to learn AFL coding. Can anybody help me out.

Regards,

Sonjoe

Oh great, in the entire AB space, there is only one kind of error and everyone can read your mind.

How does HHV function compute average volume ? Use an MA (Moving Average) function and read the Docs.

Then you need to have enough data, which you didn't care to also let us know about.

1 Like

Hello Travick,

Good Morning and how are you? I'm just trying to find out stocks with good volume were the average volume should be greater than 30,00,000 over a period of 252 days. Is it possible to develop such an AFL code. What more details u want....Acutally this condition i saw in video.

Regards,

Sonjoe

//Exploration to find stocks were the Average volume over a period of 252 days should be > 30,00,000

Filter = V > 10 * Ref(V,-1) AND V > 3000000;
AddColumn(V,"Volume",1);

Is this code correct...but i have a doubt whether this satisfies the above condition

Regards,

Sonjoe

@sonjoejh, did you take any notice of this??? @travick is kindly trying to help you.

1 Like

Ok i have edited the formula ....just look at the current code now. Please look whether this code is correct and satisfies my condition in the exploration.

//Exploration to find stocks were the Average volume over a period of 252 days should be > 30,00,000

Filter = V > MA(V,252) AND V > 3000000;
AddColumn(V,"Volume",1);

Still doubt whether my code is correct.

Regards,

Sonjoe

Close, try this.

Filter = MA(V, 252) > 3000000;

I run the exploration but its gives me some stocks which does not satisfy the condition. I have attached a screen shot were the errors have been marked in yellow. Just kindly look into it.

Exp%20Result

Regards,

Sonjoe

@sonjoejh, Are those highlighted figures average volume or single bar volume?

Thank how can i know....can u tell me how to check

Regards,

Sonjoe

@sonjoejh, what array did you put in 'AddColumn'?

I put just "V" see the code down

//Exploration to find stocks were the Average volume over a period of 252 days should be > 30,00,000

Filter = MA(V,252) > 3000000;
AddColumn(V,"Volume",1);

I think addcolumn is wrong...Do confirm. If i put MA it gives an error.

Your feedback

Regards,

Sonjoe

Replace "V" with the above.

3 Likes

Ok now its working perfectly fine. Thanks a lot TrendSurfer

Regards,

Sonjoe

1 Like

Thanks, but as you can see, something that could've been solved in a few posts just extend to 14 and stretch over 3 hours.
That's why the response to a post is exactly the way it was served.
Had the entire code and explanation been well written and explained, the 2nd post would've had a free ride code as some other members refer to :slight_smile:

Ok Thank You Travick....point noted.