Why does the EA always "close at stop" many days before end date for testing?

 
When I test an EA, it always "close at stop" many days before the end date set for testing. I double checked the code and there's no this kind of sentences. It means it happens not consistent with the code strategy, thereby misleading with the testing report. Below are examples, If testing during 9/21, 2013 to 9/21, 2014, all open orders are closed("close at stop") on 7/25, 2014 If testing during 1/1, 2014 to 10/23, 2014, "close at stop" on 7/25, 2014 if testing during 7/25, 2014 to 10/23, 2014, "close at stop" on 8/29, 2014 if testing during 9/20, 2014 to 10/24, 2014, "close at stop" on 10/23, 2014 Who can help me to know the root cause? How to correct the problem? Thanks in advance!
 
Show us your code then. Please use SRC (besides video icon) when  posting codes.
 

Is there a reason in the journal tab?

1) There can be a zero-devide after the last order? (look in the journal)

2) The Equity (not balance) has become to low (0.00$)

 
Hi Gooly, thanks. I checked the journal which says "stopped because of Stop Out". There's no stop loss set in my code. How to understand it?
 
besides above, also found this error "2014.10.28 15:31:31.099 TestGenerator: unmatched data error (volume limit 316 at 2014.09.19 16:00 exceeded)"
 
jollydragon:
Hi Gooly, thanks. I checked the journal which says "stopped because of Stop Out". There's no stop loss set in my code. How to understand it?

It is not stop loss. It is actually a stop (exit) date, from this date to that date. So, when the end of test date reached, the tester will close all trades. It is common.


jollydragon:
besides above, also found this error "2014.10.28 15:31:31.099 TestGenerator: unmatched data error (volume limit 316 at 2014.09.19 16:00 exceeded)"
This means the tick data is not enough, which is common. No body could have a full tick data.
 
"896: It is not stop loss. It is actually a stop (exit) date, from this date to that date. So, when the end of test date reached, the tester will close all trades. It is common." Please refer to my examples. It's not real stop date, why does it stop that time?
 
jollydragon: I checked the journal which says "stopped because of Stop Out". There's no stop loss set in my code. How to understand it?
Stop out is a margin call. You've lost all free margin and likely 50% of your account because your broker would have forcefully closed your positions.
  1. You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
  2. Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
  3. Do NOT use TickValue by itself - DeltaPerlot
  4. You must normalize lots properly and check against min and max.
  5. You must also check FreeMargin to avoid stop out
 
WHRoeder:
jollydragon: I checked the journal which says "stopped because of Stop Out". There's no stop loss set in my code. How to understand it?
Stop out is a margin call. You've lost all free margin and likely 50% of your account because your broker would have forcefully closed your positions.
  1. You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
  2. Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
  3. Do NOT use TickValue by itself - DeltaPerlot
  4. You must normalize lots properly and check against min and max.
  5. You must also check FreeMargin to avoid stop out

Just to be more precise, a "Stop out" is not necessarily the same as a "margin call". It's broker dependent.
 
Dear WHoeder, How to understand these 2 ? 2.Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD) 3.Do NOT use TickValue by itself - DeltaPerlot Thank you for support.
 
jollydragon:
Dear WHoeder,How to understand these 2 ? 2.Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD) 3.Do NOT use TickValue by itself - DeltaPerlotThank you for support.
open an excel sheet enter some values for the calculation and play around with to learn the meaning of this.