Amibroker Articles will give AFL Programmers and learners much need support. Even Amibroker Articles will guide the traders who just know the basics of AFL in a right direction. Traders, Programmers who are very much interested in learning AFL Programming and Code Writing can go through Amibroker Articles in BuySellTips.in.
AFL Programming is not that complicated as what you think off. New Day identification is very much easy and simple for any AFL Programmer. Especially who just started working on Amibroker Formula Language. Lets have simple code which will identify New Day. Main purpose of the below code is for identifying new day when your trading system or backtesting requires. Traders can also use the below code for future analysis where ever required. After testing code and got the accuracy, it can be used.
****The following code used to check for new day****
dnArr = DateNum();
newDay = dnArr != Ref( dnArr, -1);
Very important is that “dnArr” variable is an array.
Amibroker AFL Code To Identify New Day:
Each Day number representing with a particular value is given DateNum() function. Primarily the number is calculated based on the below formulae:
10000 * (year – 1900) + 100 * month + day
For Example Lets take Todays date: Oct 15, 2015
Calculation -> 10000 * (2015 – 1900) + 100 * 10 + 15 = 1,151,015.000
And value for yesterday (Oct 14, 2015) would be 1,151,014.000.
Programmers can change the value of time intervals based on your requirements. 5 minute bar interval is locked means, the value of “dnArr” for the first bar of the day will be 5. Rest all other would be 0.
The above code is just for information sharing purpose and apply the code once you cross check it. Validation and Testing needs to be done prior to use. Not only the above AFL code, but any other Amibroker Forumale.