Download MetaTrader 5
To add comments, please log in or register
How to earn at MQL5.community? Come and find out!
moonsboy
889
moonsboy 2014.10.25 01:50 
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!
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.10.25 01:52  
Show us your code then. Please use SRC (besides video icon) when  posting codes.
Carl Schreiber
5967
Carl Schreiber 2014.10.25 06:10  

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$)

moonsboy
889
moonsboy 2014.10.28 07:29  
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?
moonsboy
889
moonsboy 2014.10.28 07:33  
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)"
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.10.28 07:56  
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.
moonsboy
889
moonsboy 2014.10.28 10:22  
"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?
whroeder1
13656
whroeder1 2014.10.28 17:13  
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
Alain Verleyen
Moderator
28705
Alain Verleyen 2014.10.28 20:15  
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.
moonsboy
889
moonsboy 2014.10.29 02:32  
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.
Carl Schreiber
5967
Carl Schreiber 2014.10.29 14:22  
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.
/
To add comments, please log in or register