Friday, December 16, 2011

AFL Code Writing : Lesson 2 (Part 5)

If you read the previous lessons, you know how to plot/display price through candlestick/bar and you are also able to explain the every word of the below code :

_SECTION_BEGIN("Price");
Plot( Close, "Close", ParamColor("Color", colorGold), ParamStyle("Style", styleCandle, maskAll));
_SECTION_END();


Today, we will learn how to write comments in the code. It's simple. We can write comments by two ways :

(1) Single line comments that starts with //
//It's single line comments

(2) Multi line comments that starts with /* and end with */
/*It's a
multi line
comments*/


Why we use comments? Is it necessary? It's depend on you. You can complete a full afl code without comments. It has no programming value. Usually, I use comments to
=> describe the code so that after 5 years I can understand why I used this code.
=> block code.

Let's see a practical example :

/*
-------------------------------
I've written this Code for the
purpose of my blog writing.
Date : December 16, 2011
-------------------------------
*/

_SECTION_BEGIN("Price");
//The below line code is not active
//Plot( Close, "Close", ParamColor("Color", colorGold), styleBar);

//The below code will display the price through candlesticks
Plot( Close, "Close", ParamColor("Color", colorGold), ParamStyle("Style", styleCandle, maskAll));
_SECTION_END();


Allah Hafiz.

No comments:

Post a Comment