Validation EA "position stop out triggered "

 

I try send EA for validate. its Validation completed with errors

test on EURUSD,H1 (netting) 2021.02.04 20:00:00 position stop out triggered at 45.98% [#2 buy 5 EURUSD 1.2104456 tp: 1.22345] stop out occurred on 2% of testing interval strategy tester report 1 total trades 

I try fix its. please tel me how to edit my EA

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
What are the differences between the three modes of testing in MetaTrader 5, and what should be particularly looked for? How does the testing of an EA, trading simultaneously on multiple instruments, take place? When and how are the indicator values calculated during testing, and how are the events handled? How to synchronize the bars from different instruments during testing in an "open prices only" mode? This article aims to provide answers to these and many other questions.
 
Thitikorn Yaowasang: I try send EA for validate. its Validation completed with errors

test on EURUSD,H1 (netting) 2021.02.04 20:00:00 position stop out triggered at 45.98% [#2 buy 5 EURUSD 1.2104456 tp: 1.22345] stop out occurred on 2% of testing interval strategy tester report 1 total trades

I try fix its. please tel me how to edit my EA

You are not calculating your risk properly and using a volume that is too large, leading to a Margin Stop-Out. In other words, your risk management is flawed.

 
I have the same problem, but I think it is user job to take the risk calculation not EA. Especially when the second stage of verification is for gold and my EA is not written for gold.
 
Hi Guys ,
I have been through the same pain. When I was trying to publish the Ea in mql I got this error. Though I have freemargin check method added in my code 

if(!CheckMoneyForTrade(symbol,lots,type))
     {
      commentText+="Not enough money for trade";
      MessageBox(commentText);
      hasMoney=false;
      return;

     }
before the ordersend

still I got this error. This will appear specially for XAUUSD symbol. There is one cleaver way to get past to it. in your ea input make stoploss and takeprofit pips settings to 0, but add two additional stoploss and takeprofit amount. The later ones close the trades manually when stoploss and takeprofit of your ea reaches some amount. It will pass the validation .

example 

input double STOPLOSS =0; // Stoploss in pips [0:disable]

input double TAKEPROFIT =0; // TakeProfit in pips [0:disable]

input double PROFIT_AMOUNT= 2; // Profit Amount

input double LOSS_AMOUNT= 1; // Loss Amount

  if(PROFIT_AMOUNT>0 && TotalCurrentProfit(Symbol())>PROFIT_AMOUNT)

        {

         CloseAllOrders(Symbol());

        }

      if(LOSS_AMOUNT>0 && TotalCurrentProfit(Symbol())<-LOSS_AMOUNT)

        {

         CloseAllOrders(Symbol());

        }

 

Biswarup Banerjee #:
Hi Guys ,
I have been through the same pain. When I was trying to publish the Ea in mql I got this error. Though I have freemargin check method added in my code 

IMO free margin check would be somewhat misleading when your strategy is opening many trade. it could still be OK to open a trade since you have a free margin but will close all the position if price reverse. 

 
grejzen #:
I have the same problem, but I think it is user job to take the risk calculation not EA. Especially when the second stage of verification is for gold and my EA is not written for gold.

Ea only do what you told them to. If your EA not written for gold but you want to trade it for gold then change the code. You can't expecting the EA to know what you want if you not make them know.

Reason: