Ami Code for Harmonic Trading Patterns

#2
AFL for intraday trading.

hi im new to this forum. can anyone kindly help me to develop an AFL for the below mentioned condition :

AFL for intraday trading.
I want to buy or sell 3 lots of 50 quantity

Buy when EMA (Close, 7) > EMA(Close, 21)

If bought
{
Then sell
1. one lot when Current price is 0.33% more than Buying Price.
2. One lot when Current price is 0.5% more than Buying Price.
3. and balance or full quantity when EMA (Close, 3) < EMA(Close, 7).

}

Sell when EMA (Close, 7) < EMA(Close, 21)

If sold
{
Then cover
4. one lot when Current price is 0.33% lower than Buying Price.
5. One lot when Current price is 0.5% lower than Buying Price.
6. and balance or full quantity when EMA (Close, 3) > EMA(Close, 7).

}

Plot Buy / Sell arrow on the graph. And I want to do back testing using this.

Best Regards
Umesh