Which way the EA can count

 
Hi I'm having an EA there are total count trades of loss and won and total trade which way of counting loss trades when the stop loss have been reached of with a small of -1.23 USD which way to count loss on the EA thanks 
 
Lungile Mbanjwa:
Hi I'm having an EA there are total count trades of loss and won and total trade which way of counting loss trades when the stop loss have been reached of with a small of -1.23 USD which way to count loss on the EA thanks 

You should count a loss based on the deal profit

double profit = HistoryDealGetDouble(ticket, DEAL_PROFIT);
if(profit < 0.0) { /* count as loss */ }
If you want to ignore/exclude near‑breakeven fluctuations apply threshold  if(profit < -2.00).
 
Lungile Mbanjwa:
Hi I'm having an EA there are total count trades of loss and won and total trade which way of counting loss trades when the stop loss have been reached of with a small of -1.23 USD which way to count loss on the EA thanks 

Great point by Oleksandr. However, to be more precise, you should consider DEAL_PROFIT + DEAL_COMMISSION + DEAL_SWAP.

Sometimes a trade hits a small Take Profit, but after deducting commissions and swaps, the net result is negative.
If you want to count 'Economic Losses,' use the net profit. If you only care about 'Price Action' (whether the SL was hit), then checking the DEAL_PROFIT or the DEAL_REASON (to see if it was DEAL_REASON_SL ) is the way to go.