Amibroker AFL Coding

Cancelado Publicado Aug 17, 2013 Pagado a la entrega
Cancelado Pagado a la entrega

I need some coding to be done that can be run in Amibroker for optimisation purposes.

Assume there are two input files (assume CSV):

1) A list of tickers with end of day stock price data starting from say 1/1/2011 till 31/12/2012 – which will be imported as the only stock price data:

TICKER,ABC,CBD, …

1/1/2011,10.15,6.74,…

2/1/2011,10.25,5.99,…

…,…,…,…

2) Dates that represent “Buy Events” on a ticker (all included in file 1 above) accompanied with a score:

2/3/2011,ABC,4.1

2/3/2011,CBD,6.5

3/3/2011,XYZ,3.2

Now I would like an AFL script to be written for this project to perform a portfolio backtesting optimization in Amibroker as per the portfolio addition and trading rules below.

Portfolio Addition Rules

The portfolio should hold a maximum of N positions at any point in time, the position size for any ticker added to the portfolio at time t should be equal to “equity value(t) /N”.

“Buy events” should be generated based on the second input file for a specific ticker only on any date where the score next to that ticker is greater >= x1. A trade should be entered on the next bar where possible, i.e. where there are less than N positions in the portfolio. Standard commission and slippage parameters should be included.

Buy events, once generated, should remain valid for y1 days (as specified in the code), unless the price of the ticker drops by more than x2% or goes up more than x3% anytime during the y1 days: then the buy signal disappears. A buy event should also be removed from the queue once the ticker has been included in the portfolio.

So there will be essentially a dynamically updated “waiting queue” for stocks to be included in the portfolio after you walk through the dates of input file 2.

Multiple signals can be given on any date (as the example snippet for file 2 above shows); if the portfolio maximum positions (=N) will be breached by including all stocks for which signals have been given and/or are still valid from previous days (waiting in the queue) - then the ranking for inclusion in the portfolio will be simply based on the stock with the highest score.

Portfolio trading rules:

1) General selling rule: if a stock has been in the portfolio for more than y2 days then it should be sold.

2) Stop profit: if any stock gains by x4% or more after y3 days then it should be sold.

3) Stop loss: if any stock in the portfolio drops by x5% or more after y4 days then it should be sold.

Further conditions

1) The successful completion of the project should include a clean prescription as to how both file 1 and 2 should be handled (how to import it etc.) – after a “clean” installation of the Amibroker software – given it will be run on a windows VPS from scratch. Assume I have no previous AFL experience.

2) Files 1 and files 2 will not be provided at the start of the project but at some later stage as I need to generate these files in parallel. I expect you to work of two dummy files yourself initially - and supply me these files to make more realistic to my situation if necessary.

The person who will be awarded this project should be able to communicate clearly and able to meet deadlines if I put them down.

Programación en C Programación en C++ Mercados financieros JavaScript Metatrader

Nº del proyecto: #4836955

Sobre el proyecto

1 propuesta Proyecto remoto Activo Aug 25, 2013