Hello Vicky,
Welcome!!! And Thanks For Participating In Discussion.
Ok, Here Is AFL Code:-
I. First Part:-
================================================== ==
_SECTION_BEGIN("Price MA BB");
Plot(MA(C,5),"MA C 5", colorRed,styleLine);
Plot(MA(C,6),"MA C 6", colorBlack,styleLine);
Plot(BBandTop( Close, 9, 2 ), "BBandTop 9 2", colorBlue,styleLine);
Plot(BBandBot( Close, 9, 2 ), "BBandBot 9 2", colorBlue,styleLine);
Buy = Cross(MA(C, 5), MA(C, 6));
Sell = Cross(MA(C, 6), MA(C, 5));
_SECTION_END();
================================================== ====
What Does It Tells?
a. Plotting SMA 5
b. Plotting SMA 6
c. Plotting BB 9, 2 Top
d. Plotting BB 9, 2 Bottom
e. Buy- where 5 SMA crosses 6 SMA
f. Sell- where 6 SMA crosses 5 SMA
Here I Didn't Find BB Array Method To Choose It As SMA( For Plotting Only, Nothing To Do With Trigger). But If You Use Above Code And Additionaly Check BB With Drag 'n' Drop Method Choosing Price Field With 'Average' You Will Get Exactly Same Picture. So I Think You Can Use It Safely. If I Find Any Update, I Will Definately Post It.
II. Second Part:-
Let Us Say We Want To Check Highly Liquid Stock Only(Of Course For B/S Trigger), You Can Use Following Code. Whatever Little I Know, It Uses Value(Vol.) For The Day You'r Scanning:
================================================== ==
_SECTION_BEGIN("Price MA BB");
Plot(MA(C,5),"MA C 5", colorRed,styleLine);
Plot(MA(C,6),"MA C 6", colorBlack,styleLine);
Plot(BBandTop( Close, 9, 2 ), "BBandTop 9 2", colorBlue,styleLine);
Plot(BBandBot( Close, 9, 2 ), "BBandBot 9 2", colorBlue,styleLine);
Buy = Cross(MA(C, 5), MA(C, 6)) AND V > 250000;
Sell = Cross(MA(C, 6), MA(C, 5)) AND V > 250000;
_SECTION_END();
================================================== ====
Here In This Case It Uses Value More Than 2.5 Lakh. If You Want To Adjust It Just Change 250000 To Desired Value.
III. Third Part:-
Let Us Say We Want To Use Average Volume For Last Five Days. Then Code Will Go Like This:-
================================================== ==
_SECTION_BEGIN("Price MA BB");
Plot(MA(C,5),"MA C 5", colorRed,styleLine);
Plot(MA(C,6),"MA C 6", colorBlack,styleLine);
Plot(BBandTop( Close, 9, 2 ), "BBandTop 9 2", colorBlue,styleLine);
Plot(BBandBot( Close, 9, 2 ), "BBandBot 9 2", colorBlue,styleLine);
Avg_vol = (Ref(Volume,-4)+ Ref(Volume,-3)+ Ref(Volume,-2)+ Ref(Volume,-1)+ Volume)/5;
Buy = Cross(MA(C, 5), MA(C, 6)) AND Avg_vol > 250000;
Sell = Cross(MA(C, 6), MA(C, 5)) AND Avg_vol > 250000;
_SECTION_END();
================================================== ====
Yes, You Guessed Right It Represents Average Volume For Last Five Days 2.5 Lakh. You Can Adjust This Value For Your Need As Mentioned In 2'nd Part.
IV. Fourth Part:-
If Signals Are Too Many. We Might Need To Stick To Only Stronger One. In Case Of Buy Trigger, Stock Which Closed Above Opening And In Case Of Sell Trigger, Stock Which Closed Below Opening Should Represent Some Strength Than Rest Other. If You Want To Filter Out This Way, Then Here Is A Final AFl Code:-
================================================== ==
_SECTION_BEGIN("Price MA BB");
Plot(MA(C,5),"MA C 5", colorRed,styleLine);
Plot(MA(C,6),"MA C 6", colorBlack,styleLine);
Plot(BBandTop( Close, 9, 2 ), "BBandTop 9 2", colorBlue,styleLine);
Plot(BBandBot( Close, 9, 2 ), "BBandBot 9 2", colorBlue,styleLine);
Avg_vol = (Ref(Volume,-4)+ Ref(Volume,-3)+ Ref(Volume,-2)+ Ref(Volume,-1)+ Volume)/5;
Buy = Cross(MA(C, 5), MA(C, 6)) AND Close > Open AND Avg_vol > 250000;
Sell = Cross(MA(C, 6), MA(C, 5)) AND Close < Open AND Avg_vol > 250000;
_SECTION_END();
================================================== ====
V. Fifth Part:-
You Can Always Switch Between Volume, Avg Volume , Open Close Filter. To Find Best Suited Way For You. I Think This Sums Up All Whatever I Know.
- Please Make Sure To Remove Dotted Lines, Code Is In Between Those Dotted Line. Then Go To Analysis > Formula Editor > Paste Code Here > Rename > Save. Now It Should Appear In Custom Folder.
- To Plot SMA And BB Just Drag 'n' Drop AFL File In Custom Folder To Graph. Please Check Rajendrani And PKamlesh Post From This:
http://www.traderji.com/amibroker/27489-help-need-afl-savantjis-system.html.
- If You Want Scan EOD Data For Trigger Then Go To Analysis > Automatic Analysis > Pick AFL > Select Date For Which You Want To Scan Data > Hit Scan. Aaha....!!! Now You Should See Triggers.
Now EveryOne Should Find It Easy To Use. Thanks To EveryOne Especially SavantJi, Dj,Rajendrani, PKamlesh For Guidance, Without Guidance Even Simpler Thing Becomes Difficult.
For Future Update And Easy To Find Code Please Check This Thread:-
http://www.traderji.com/amibroker/27489-help-need-afl-savantjis-system.html
Thanks
@ Doc Vijay, Can you please put the AFL for me once more? I hav looked through 150 pages wih no luck.