What happen if amount is zero in ApplyStop

The Optimization result is best with the amount in ApplyStop to be 0.

  • ApplyStop( stopTypeLoss, stopModePoint, 0, True );

Do this mean the order should be closed at zero loss?

Optimization with unrealistic inputs can produce unrealistic outputs, it is therefore up to you to make sure it is practical.
If you have a system that is like Buy = L; and Sell = H;, the backtest results will be astonishing but is it consistently possible in real-time ?


Despite whether it is realistic or practical, I found from backtest results that putting zero there do not close the order with zero loss, instead it doesn't close the order until other closing condition met. I just want to confirm this finding.

That's very strange... I've done a quick test and It seems that a 0 value is interpreted by Amibroker as: "No stop loss"... I've got the same results with and without the line:

ApplyStop(stopTypeLoss, stopModePoint, 0, 1);

Can anybody confirm this result?

It is not strange. It is totally by design to prevent absurd output. Zero 'stop amount' means disable stop.

And no it is not surprising that you are getting better gain with no stop because stops typically make profits lower. The purpose of stop is not to increase gain but to decrease the risk (potential of huge loss). With decreased risk the profitability also decreases. There is no free lunch in stock market.