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 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
}
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.
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.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I try send EA for validate. its Validation completed with errors
I try fix its. please tel me how to edit my EA