Help: Need AFL for SavantJi's System

docvijay4u

Well-Known Member
#11
Ok, got it Captain:). I see that plotting of SMA, SMA crossover is perfect. But when I scan with automatic analyser results are not satisfactory. I mean say I scan for today's bhavcopy according to current formula(SMA crossover), it gives signal to each and every scrip which is touching, piercing up and down the crossover. I think we need conditional comment that "like show scrip with closing price above the bullish crossover(for buy), closing price below bearish crossover(for sell)." So another difficulty, but I am sure it will be solved over the period of time. Thanks.

Hi Doc,

Ok, If You Have Charting Software Such AMIBROKER, One Can Open A Daily or Intraday Chart & Choose The SMAs & BBs & Can See The Chart Like The One Posted....By Rajendrani.

You Can Do That With Individual Scrips & See It.

What We Are Looking Out For Is That Bhavcopy From NSE Which Will Include All The Traded Scrips Which Are Extracted From The Bhavcopy & Converted In AMI or MS, & Then When You Use A Particular .afl Depending On Parameters Programmed In The .afl It Will Go Through All The NSE Scrips & Give You A List or Report Which Match The Criterias Of That Particular .afl Programme.

For Instance The One Programmed By DJSinha BB.afl When That Is Used It Will Give You A List Of Scrips Meeting Those Parameters Programmed In It, Similarly We Need One For SMAs So That One Doesn't Have To Open The Chart Of Each Every Scrip To See What The SMAs & BB Are Doing.


Let's Say You Had 1000 Balls Of Different Colours & Wanted To Know How Many Of A Particular Colour Is There....Once The .afl For Colour Query & Quantity Is Activated Or Run It Will Generate A Report Telling X Number Of Balls Of Colour B Is There.

Opening Individual Charts Of Scrips Seeing Them With Parameters That You Want Is Similar To Sorting & Going Through Each Ball Manually.


In Simple Words .afl Is Query That A Software Understands


Got It......Hmmm....Sorry To Pinprick Your Short Lived Elation....:)


Happy & Safer Trading

SavantGarde
 

docvijay4u

Well-Known Member
#12
Ok one more baby step BB plotted. Here we are:

Fixed:

a. Plotting SMA 5 ------------------------------ done
b. Plotting SMA 6 ------------------------------ done
c. Plotting BB 9, 2 Top ------------------------- done
d. Plotting BB 9, 2 Bottom ---------------------- done
e. Buy- where 5 SMA crosses 6 SMA ------------ done
f. Sell- where 6 SMA crosses 5 SMA ------------- done

Tweaking Needed:

a. BB should follow SMA(or SMA feature should be there).


Here is a AFL uptil Now:

====================================================

_SECTION_BEGIN("Price MA BB");

Plot(MA(C,5),"MA C 5", colorRed,styleLine);
Plot(MA(C,6),"MA C 6", colorBlack,styleLine);
Buy = Cross(MA(C, 5), MA(C, 6));
Sell= Cross(MA(C, 6), MA(C, 5));
Plot(BBandTop( Close, 9, 2 ), "BBandTop 9 2", colorBlue,styleLine);
Plot(BBandBot( Close, 9, 2 ), "BBandBot 9 2", colorBlue,styleLine);

_SECTION_END();

======================================================

Thanks.:)
 

SavantGarde

Well-Known Member
#13
Doccccccccc.!!!!!!!

Wow...Not Bad Congratulations !....looks Like You Are Fired Up On All Cylinders.... Doc.....:)

Ok, If You Have An Option In BB Available To Select Moving Avg. Then You Select SMA. I Don't Know If It Is Available In All Charting Software Or Not.

Otherwise Looks Done, But Need To See The Report Or Chart That This .afl Spews Out.....:)


Happy & Safer Trading

SavantGarde






Ok one more baby step BB plotted. Here we are:

Fixed:

a. Plotting SMA 5 ------------------------------ done
b. Plotting SMA 6 ------------------------------ done
c. Plotting BB 9, 2 Top ------------------------- done
d. Plotting BB 9, 2 Bottom ---------------------- done
e. Buy- where 5 SMA crosses 6 SMA ------------ done
f. Sell- where 6 SMA crosses 5 SMA ------------- done

Tweaking Needed:

a. BB should follow SMA(or SMA feature should be there).


Here is a AFL uptil Now:

====================================================

_SECTION_BEGIN("Price MA BB");

Plot(MA(C,5),"MA C 5", colorRed,styleLine);
Plot(MA(C,6),"MA C 6", colorBlack,styleLine);
Buy = Cross(MA(C, 5), MA(C, 6));
Sell= Cross(MA(C, 6), MA(C, 5));
Plot(BBandTop( Close, 9, 2 ), "BBandTop 9 2", colorBlue,styleLine);
Plot(BBandBot( Close, 9, 2 ), "BBandBot 9 2", colorBlue,styleLine);

_SECTION_END();

======================================================

Thanks.:)
 

docvijay4u

Well-Known Member
#14
Yes Sir (please dont stop me this time it just came from within). Actually I deleted two of the Tweaks from the list. We'll discuss it shortly.

Oh main Point is Captain whatever I am finding is Simply Superb!!!!:rofl: I will post my results ASAP. Only thing I can mention now is We can Catch those Golden Entry Point Very Very Soon(Let us say in Infancy )... :thumb:

Thanks a Lot :)
Doccccccccc.!!!!!!!

Wow...Not Bad Congratulations !....looks Like You Are Fired Up On All Cylinders.... Doc.....

Ok, If You Have An Option In BB Available To Select Moving Avg. Then You Select SMA. I Don't Know If It Is Available In All Charting Software Or Not.

Otherwise Looks Done, But Need To See The Report Or Chart That This .afl Spews Out.....:)


Happy & Safer Trading

SavantGarde
 

SavantGarde

Well-Known Member
#15
Doc, Doc, DocViay (Victory)

You Need To Pat Yourself.....I Am Glad You Are Getting Those 'Golden Entry Points' Term You Coined Will Be Used Henceforth To Describe....Point

Brilliant......Simply Brilliant....! By The Way What gave You An Idea That I was Going Stop You....Hehehehe....Never

Savant<<<<<<< :eek: Has No AMI or MS Or Anything,,,,,Wish Had It To Be Able To See It.....

Ok.....Next Plans.... To Be Excuted....

a) Intraday Trading Strategy With No Overnight Position

b) Index Futures Intraday Trading....Already In Progress (Almost Complete)

c) Stock Futures Trading For Intraday.....Yet To Start (Point To Form The Basis)

d) Finally....Forex Intraday & Positional Trading.....Almost 70% Work Done On It.

Upto It Doc, Prasad, Kamalesh, DjSinha, Columbus & Others Frends Here


Happy & safer Trading

SavantGarde



Yes Sir (please dont stop me this time it just came from within). Actually I deleted two of the Tweaks from the list. We'll discuss it shortly.

Oh main Point is Captain whatever I am finding is Simply Superb!!!!:rofl: I will post my results ASAP. Only thing I can mention now is We can Catch those Golden Entry Point Very Very Soon(Let us say in Infancy )... :thumb:

Thanks a Lot :)
 
#16
Doc, Doc, DocViay (Victory)

You Need To Pat Yourself.....I Am Glad You Are Getting Those 'Golden Entry Points' Term You Coined Will Be Used Henceforth To Describe....Point

Brilliant......Simply Brilliant....! By The Way What gave You An Idea That I was Going Stop You....Hehehehe....Never

Savant<<<<<<< :eek: Has No AMI or MS Or Anything,,,,,Wish Had It To Be Able To See It.....

Ok.....Next Plans.... To Be Excuted....

a) Intraday Trading Strategy With No Overnight Position

b) Index Futures Intraday Trading....Already In Progress (Almost Complete)

c) Stock Futures Trading For Intraday.....Yet To Start (Point To Form The Basis)

d) Finally....Forex Intraday & Positional Trading.....Almost 70% Work Done On It.

Upto It Doc, Prasad, Kamalesh, DjSinha, Columbus & Others Frends Here


Happy & safer Trading

SavantGarde


Very eagerly looking forward to Next Plans....

Regards,

Smart_trade
 
#17
To complete your formula:


_SECTION_BEGIN("Price MA BB");

Plot(MA(C,5),"MA C 5", colorRed,styleLine);
Plot(MA(C,6),"MA C 6", colorBlack,styleLine);
Buy = Cross(MA(C, 5), MA(C, 6));
Sell= Cross(MA(C, 6), MA(C, 5));
Plot(BBandTop( Close, 9, 2 ), "BBandTop 9 2", colorBlue,styleLine);
Plot(BBandBot( Close, 9, 2 ), "BBandBot 9 2", colorBlue,styleLine);
PlotShapes(Buy * shapeUpArrow, colorGreen);
PlotShapes(Sell * shapeDownArrow, colorRed);

_SECTION_END();
 

docvijay4u

Well-Known Member
#18
Great Thanks Dear, not checked this thread recently. Today SavantJi told me about Your Efforts. :clapping:

We might need little addition. I'll talk to You very soon.

Thanks A Lot.:)
To complete your formula:


_SECTION_BEGIN("Price MA BB");

Plot(MA(C,5),"MA C 5", colorRed,styleLine);
Plot(MA(C,6),"MA C 6", colorBlack,styleLine);
Buy = Cross(MA(C, 5), MA(C, 6));
Sell= Cross(MA(C, 6), MA(C, 5));
Plot(BBandTop( Close, 9, 2 ), "BBandTop 9 2", colorBlue,styleLine);
Plot(BBandBot( Close, 9, 2 ), "BBandBot 9 2", colorBlue,styleLine);
PlotShapes(Buy * shapeUpArrow, colorGreen);
PlotShapes(Sell * shapeDownArrow, colorRed);

_SECTION_END();
 

docvijay4u

Well-Known Member
#19
Latest Update:-

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.

Thanks:)
 
Last edited:

pkgmtnl

Well-Known Member
#20
Latest Update:-

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 Avg_vol > 250000;
Sell = Cross(MA(C, 6), MA(C, 5)) AND Close < Open 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.

Thanks:)
Sir, is it possible your to attach this file of AFL as attachment? so that it can be downloaded........! thanx with humble regrds
Sir, it gives syntax error at last two lines for BUY and SELL....
Can U please correct it?? or attach the AFL file itself
 
Last edited:

Similar threads