AmiBroker trading system coding

Job ID: 31340417

Budget: €250 – €750 EUR

Below is detailed description of rules, that need to be coded

Pre-scan: Scan all assigned stocks by choosing X%most liquid for last Y days and price between X1 and Z1.
Example: if X=10% and Y=50, then we take the top 10% of stocks which are most liquid for last 50 days.
1. Scan all the remaining assigned stocks, based on
1) current Daily Range/(N)ATR<X and
2) current daily close is within Y% below the all-time high level (based on OHLC).
Ranking - the remaining stocks are ranked by criteria 2)
2. For the first XX (govern by MaxOpenedPositions and PendingMultiplier) stocks we open buy stop based on last daily bar`s OHLC.
Buy stop= current open on Daily + (H-L) from yesterday *XZ.
Stop loss =ZZ*(N)ATR and
Trailing stop is based on custom indicator, which is similar to MA, which I will provide.
The exit of all trades is Trailing Stop or Stop Loss. Here I want to ask a question how does AmiBroker treat the exit price when the price gaps round the SL level. Will the exit price in the statement be the SL level, or the first price after the gap? Example SL=14.5, but the market gaps from 15 to 14. What will the exit price in the statement?
3. The system will monitor the opened trades and will stop sending buy stop orders when a certain amount is reached. Inputs, that will govern this part of code are MaxOpenedPositions and PendingMultiplier . Let`s take for example MaxOpenedPositions=10 and PendingMultiplier=2 and suppose from yesterday we have already 5 opened positions. The code should substitute from MaxOpenedPositions currently opened and the multiply by PendingMultiplier. The end result will be the number of pending orders the code will send today. So, (10-5)*2= 10, so the code will create 10 more buy stop orders.
All scans will be done after Daily bars are completed once a day. Pending orders are sent once a day and unfilled will be deleted at the end of the day.

Inputs:
--- Money Management---
MMPcnt - if =1, then we risk 1% of our account in this trade
FixedAmount –if MMPcnt=0, then we use this fixed amount share to buy
Related categories: Coding