Hi,
I am a beginner to Amibroker AFL. I am an experienced trader who is trying his hand at Amibroker and AFL. I have programming experience with other programming languages. I went thro' AFL tutorial and came up with a very simple AFL. The idea is to generate Buy & Sell Indicators. However, it doesn't work as required:annoyed: Can you please help me with this? Here goes the code:
_SECTION_BEGIN("AFL Example");
LongMA = EMA( C, 100 );
MidMA = EMA( C, 50 );
ShortMA = EMA( C, 20 );
Buy = Cross( ShortMA, MidMA ) AND Cross(MidMA,LongMA);
Sell = Cross( LongMA, MidMA ) AND Cross(MidMA,ShortMA);
Filter=1;
AddTextColumn( FullName(), "Company Name" );
AddColumn( Buy, "Buy", 1 );
AddColumn( Sell, "Sell", 1 );
AddColumn( C, "Close", 1.3 );
AddColumn( H, "High", 1.3 );
AddColumn( ShortMA, "Short MA", 1,3 );
AddColumn( MidMA, "Mid MA", 1,3 );
AddColumn( LongMA, "Long MA", 1,3 );
_SECTION_END();
I have also attached the screenshot and highlighted what is displayed and what I am expecting from this script. Can you please help?
Thanks,
Prash
I am a beginner to Amibroker AFL. I am an experienced trader who is trying his hand at Amibroker and AFL. I have programming experience with other programming languages. I went thro' AFL tutorial and came up with a very simple AFL. The idea is to generate Buy & Sell Indicators. However, it doesn't work as required:annoyed: Can you please help me with this? Here goes the code:
_SECTION_BEGIN("AFL Example");
LongMA = EMA( C, 100 );
MidMA = EMA( C, 50 );
ShortMA = EMA( C, 20 );
Buy = Cross( ShortMA, MidMA ) AND Cross(MidMA,LongMA);
Sell = Cross( LongMA, MidMA ) AND Cross(MidMA,ShortMA);
Filter=1;
AddTextColumn( FullName(), "Company Name" );
AddColumn( Buy, "Buy", 1 );
AddColumn( Sell, "Sell", 1 );
AddColumn( C, "Close", 1.3 );
AddColumn( H, "High", 1.3 );
AddColumn( ShortMA, "Short MA", 1,3 );
AddColumn( MidMA, "Mid MA", 1,3 );
AddColumn( LongMA, "Long MA", 1,3 );
_SECTION_END();
I have also attached the screenshot and highlighted what is displayed and what I am expecting from this script. Can you please help?
Thanks,
Prash
Attachments
-
91.1 KB Views: 303