AFL writing guide for new user

i think i am learning...
but i have some questions ????
in "C"
we do #include <> then main{}
but we don't do it here
just
_SECTION_BEGIN("price section");


_SECTION_END();

can you explain line by line plz
Dear friend,
In case C language we use functions to run any prog. Here we use same thing. Just the declaration protype is different from C funcations.
yes we write codes inside
_SECTION_BEGIN("price section");


_SECTION_END();

but not necessary always. You can write codes out side
_SECTION_BEGIN("price section");
...
...
_SECTION_END();

It will work just like global settings.
Happy learning...:thumb:
 
Very happy to see that members are actively posting in my thread. It was my intention to let other members learn AFL. happy learning to all.
 
Hi

I have a VERY STRANGE QUERY but it is very much important for all newbies as well as all the seniors & experts because it can give them an idea "before" EOD that particular stock is going to give a buy/sell signal "after" EOD.

My Query is -

Is there any way out that we can put OHLC data into/through an AFL for anyy particular scrip just before EOD (at around 3:20 PM or in case of commodities, at around 11:20 PM) so that it may give exact signals about whats coming for next day so that we may take position "before" EOD (means the same day) and benefit from the forthcoming Gap Opening.

I am asking this because I use Amibroker both for realtime and EOD and my realtime program gives realtime data backfill for max 60 days which is not sufficient to generate EOD strong signals "before" EOD due to shorter period of days. This backfill (60 days) does not show any signal (sometimes it generates signals but they are not strong enough to act upon), while "after" the EOD, the same AFL generates strong signals but in most days, the next morning the trade cannot be materialized because of Gap Opening.

Please guide if it is possible for one to put OHLC in EOD charts "before" actual EOD, i.e. near around 3:20 PM or in case of commodities, near around 11:20 PM so that we may get strong signals in our charts.

Hope to hear from all seniors & experts upon this query soon ...........

shekharz
 
Hello Dada, I have used your syntax for the back ground setting but it is not working. I am still getting the boring white background with the black and white candlestick. Here is the syntax which I used:

_SECTION_BEGIN("Debarghya: AFL Coding");
SetChartBkColor( ColorRGB( 120, 130, 140 ));
SetBarFillColor( IIf( Close > Open, colorWhite, colorBlack ) );
Plot(C,"Price", colorBlack, styleCandle );
Plot(EMA(C,3),"SMA(3)", colorRed );
Plot(EMA(C,13),"SMA(13)", colorGreen );

_SECTION_END();

Please correct me where I went wrong or if there is any thing wrong in that syntax.
 
debhargya sir,
why you are not giving any replies to my queries.
if any links or sources where we can find more helpful for codes writing in ami please mention or pm to me.
 
Dear Abhi,
Your code is perfect. I a using Ami 5.10. May be some version problem, otherwise this code is working fine in my system. :)



Hello Dada, I have used your syntax for the back ground setting but it is not working. I am still getting the boring white background with the black and white candlestick. Here is the syntax which I used:

_SECTION_BEGIN("Debarghya: AFL Coding");
SetChartBkColor( ColorRGB( 120, 130, 140 ));
SetBarFillColor( IIf( Close > Open, colorWhite, colorBlack ) );
Plot(C,"Price", colorBlack, styleCandle );
Plot(EMA(C,3),"SMA(3)", colorRed );
Plot(EMA(C,13),"SMA(13)", colorGreen );

_SECTION_END();

Please correct me where I went wrong or if there is any thing wrong in that syntax.
 
Dear preethnfo,
Due to some personal problem I don't use TRADERJI very often now a days. SO I am late to reply you. Sorry. I saw your query today. I started this thread to help others to learn AFL coding. I also wanted to have active participation from the members. I am happy to see that so many members are actively posting here. So I am successful. :)
You can learn all the basic things from here. I have already covered most of the things. Now if you have any particular strategy then you can use the codes I already gave here. Happy learning.
I will try to post more tutorial here.


debhargya sir,
why you are not giving any replies to my queries.
if any links or sources where we can find more helpful for codes writing in ami please mention or pm to me.
 
exrem( ARRAY1, ARRAY2 )
removes excessive signals:
returns 1 on the first occurence of "true" signal in Array1
then returns 0 until Array2 is true even if there are "true" signals in Array1

EXAMPLE
buy = ExRem( buy, sell );
sell = ExRem( sell, buy );
Now in plain english, once the buy signal is on you will not get another buy signal until there is a sell signal. So you must close the position before you take a new position. I hope you are clear. Happy learning.



Hi,
I have a doubt. Can you please clarify?
While using ExRem function, it is supposed to remove extra buy sell signals. What it does is, it will plot only alternate buy sell signals.
When trying to code intraday system, I dont want the extra signals, but want the FIRST signal of the day. now suppose a buy signal was formed yesterday, and a buy signal is again formed today, the ExRem function deletes that Buy signal, whereas it should be a valid signal, as it is formed next day of the previous buy signal.
Anyone have any idea around this problem?

Thanks
 
Dear Debhargya,

Thanks for the clarification.
What I want to achieve is an intraday system, which takes the first bar of the day as the starting point for all calculations. What Exrem function is doing in my code is - it removes the excess signals, but suppose if a Buy was formed yesterday, then today also it will only take a Sell signal, and ignore if a Buy is formed today, as yesterday's Exrem is still valid.
Basically, the idea is like clearing the cache at the start of the day, everyday, so that both Buy and Sell signals become zero at the start of the day.
 
Thank you Dada, It is working now. I have find out how to connect the AFL language written to the chart. Your Code is absolutely correct and it is working fine on my system :) Dada one more thing..I import data from the bhavcopy to test the graphs and signals currently, the problem with bhavcopy is it is not giving the scrip name rather the ticker no. Is it possible to write an AFL code so that the ticker can be converted to Scrip full name.
 

Similar threads