There are various methods to prepare the feature dataset, which is a crucial input for a machine learning prediction model. One approach is to code technical indicators using Python and feed them as input to the model. Another simpler approach is to utilize Amibroker’s AFL Exploration, which provides built-in indicators and also supports custom indicators that are easy to code, explore, and prepare as feature datasets. The exploration dataset can then be extracted in CSV format.
Understanding Features and Targets
In machine learning, features represent the input data points or independent variables used to describe various aspects of the object under study. Targets, on the other hand, are the output or dependent variables that the model aims to predict or classify based on the input features.
If you are a beginner in Machine Learning the first thinking will be that technical analysis indicators like rsi, macd, ema, etc can be used to predict the value of Nifty the next day close. Will be using Amibroker to prepare the dataset easily.
Amibroker AFL Code for Exploration
Filter = 1;
AddColumn(Open,"Open",1.2);
AddColumn(High,"High",1.2);
AddColumn(Low,"Low",1.2);
AddColumn(Close,"Close",1.2);
AddColumn(Volume,"Volume",1.2);
AddColumn(Ref(Close,-1),"prevclose",1.2);
AddColumn(RSI(14),"rsi",1.2);
AddColumn(EMA(Close,5),"ema5",1.2);
AddColumn(EMA(Close,10),"ema10",1.2);
AddColumn(HMA(Close,5),"hma5",1.2);
AddColumn(HMA(Close,7),"hma7",1.2);
AddColumn(HMA(Close,9),"hma9",1.2);
AddColumn(ADX(14),"adx",1.2);
AddColumn(PDI(14),"pdi",1.2);
AddColumn(MDI(14),"mdi",1.2);
AddColumn(ATR(10),"atr",1.2);
AddColumn(Ref(Close,1),"close_forecast",1.2);
Performing Exploration
1)Open Amibroker and Select the Respective EOD database which contains EOD data to be exported as features dataset.
2)Save the above afl code as Feature Set EOD Close Prediction.afl inside formulas/custom folder (or any other folder of your choice)
3)Open New Analysis and Selec the Feature Set EOD Close Prediction.afl code
4)Click on Settings icon and Select the periodicity as Daily to export features data from daily timeframe
5)Press Explore to get the Features Dataset. Once Exploration is done goto File -> Export HTML/CSV data and save the file as NIFTY_EOD.csv in your local folder
6)Download the NIFTY_EOD.csv file