AFL writing guide for new user

#32
Thank you for posting here. You see what I found very few are here to learn something. Most are here to have a good so called AFL and wan a make profit. I started this thread with the true intention to help other new comers on AFL. Because when I started learning AFL I was no where. There are very very rare free metrical available to learn AFL. But where is the crowd? Crowd is behind the quick copy paste mechanism.
If i start posting some AFL with long long lines of code. Many will thank me and will start using back testing and all the stuffs blindly with out knowing what they are!!! It is very true. So being sad I stopped posting here.
I have many good small size codes available to undertsand the basic. You know once you learn it, you dont need to beg others for "Sir sir please give me your AFL, sir made this AFL for me etc etc.". You know what I mean. We must learn and do it myself, that is my policy.
How ever thank you for your post. May be I will start posting here again.

whatever you have written is very right in all the aspects. other follows or not follows one should carry. time will see that lot other will come and follow. it is also a game of patience and discipline so have patience and conitune your disciplined efforts, this section will explore for sure. i never thought of undestanding and writing any afl but with this section i has started thinking at least on this aspect to avoid this please give me this and that because one can make at least simple afls if one can try.
 

EagleOne

Well-Known Member
#34
Very nice initiative, DM. Hope you'd make this thread kind of 'Teach a man how to fish'. This time for AFL. Good luck. :)
 
#35
Hello Traderji Friends,

Lets start our AFL coding lesson on again. Sorry I could not update here for few days, many requested me but due to lack of time I was unable to update. Today I think I can manage my times to post here.

As I said said earlier that, I am not going to upload some hefty AFl codes that has so much complex things that we can not understand. Only the code writer can understand. So keeping our system simple I am going to give some basic but very useful stuffs again.
:D
 
#36
PLOT PRICE IN AFL

I have already posted one post that has described how we can plot price in AFl. but that was very simple. That was only plotting Candle price in charts.

Today I am talking about in depth price plotting,

Basic way,

_SECTION_BEGIN("price section");
Plot( Close, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();


Very Basic black and White candlestick chart. Boring!!!


Lets do some different things here.

_SECTION_BEGIN("Debarghya: AFL Coding");
Plot(C, "Price", colorRed, styleBar );
_SECTION_END();


Red color Bar chart.

Ok, now what I have done here? I have used "C" as closing price. But two things that we can change, that is "colorRed" and "styleBar". Lets change them as we want,

Styles:
  • styleCandle
  • styleLine
  • styleBar

Colors:
  • colorRed
  • colorBlack
  • colorYellow
  • colorGreen
  • ColorWhite
  • etc

So lets take some Examples,
_SECTION_BEGIN("Debarghya: AFL Coding");
Plot(C, "Price", colorGreen, styleBar );
_SECTION_END();

_SECTION_BEGIN("Debarghya: AFL Coding");
Plot(C, "Price", colorYellow, styleLine );
_SECTION_END();
 
#37
Friends I am leaving now, my students have come. I will update more at tonight. I hope you guys will be here.

Bub bye now, have a great evening.
 

EagleOne

Well-Known Member
#38
...........................
 
Last edited:
#39
COLORFUL PRICE CHART

Hello friends,
lets make some colorful charts now. We have already seen that many experts ( :D ) write AFL codes that gives us nice colorful charts. How they do that? Let me explain that.


So here is the code

_SECTION_BEGIN("Debarghya: AFL Coding");
SetBarFillColor( IIf( Close > Open, colorWhite, colorBlack ) );
Plot(C, "Price", colorRed, styleCandle );
_SECTION_END();


What we are doing here? well just checking whether closing price is greater than opening or not! That means bull day or bear day? And our SetBarFillColor() function making our candle they way we want. ok? SImple isn't it?

Now SetBarFillColor( IIf( Close > Open, colorWhite, colorBlack ) ); bolded color code you can change to make your own colorful candle. Enjoy it.
 
#40
COLORFUL BACKGROUND PRICE CHART

Now I want to set the background color of any chart
My function is
SetChartBkColor( color )

here is a sample code,
_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();


here is the screen out put



_SECTION_BEGIN("Debarghya: AFL Coding");

SetChartBkColor( ColorRGB( 220, 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();

 
Last edited:

Similar threads