Hello frnds,
Can anyone guide me how to backtest the futures market?
As the futures market have certain expiry and its not practically possible to keep inputting "From and to dates" in backtest setting, can anyone guide how to incorporate this "from and to dates in afl itself and we can add as many dates as possible in it, so that the contract ends on the particular dats and fresh entry can be taken on the from dates.
plz guide me
Can anyone guide me how to backtest the futures market?
As the futures market have certain expiry and its not practically possible to keep inputting "From and to dates" in backtest setting, can anyone guide how to incorporate this "from and to dates in afl itself and we can add as many dates as possible in it, so that the contract ends on the particular dats and fresh entry can be taken on the from dates.
plz guide me
Glad to see you here on traderji. I've seen many posts of yours on ***********.
If you dig around internet, you will find an AFL function that detects Last Thursday of month but using this function has its limitations. This is your first starting point. However, the problem is that if you use this in AFL and plot the AFL on a Cash Stock, the AFL will still assume that your stock is going to rollover on Last thursday.
The better (simplest) approach I have found is to create a text file (CSV file) in which I place name of amibroker symbol and full contract expiry date. With this approach, I can have symbols such as NIFTY16OCTFUT and NIFTY_F1 and NIFTY_F2 and NIFTYBEES all in same database. With the date coming from flat file (read and absorbed by symbol), rolling the contract becomes a very trivial task.