I have the following amibroker afl backtesting code with stop-loss set at 10 points and profit target set at 20 points.
long_entry_condition = close > EMA(close, 50);
Buy = long_entry_condition;
BuyPrice = Close;
risk = 10;
ApplyStop(Type=stopTypeLoss, mode=stopModePoint, Amount=risk,
ExitAtStop=1, volatile=False, ReEntryDelay=0, ValidFrom=0, ValidTo=-1 );
ApplyStop(Type=stopTypeProfit, mode=stopModePoint, Amount=2*risk,
ExitAtStop=1, volatile=False, ReEntryDelay=0, ValidFrom=0, ValidTo=-1 );
Suppose I want to take profit for half the position at 10 points. Then for the remaining half position, I want to set the stop loss level to breakeven and the profit target at 30 points. How do I modify the existing code to achieve this?