Module 03 · Risk engineering · Lesson 11
Daily loss stops and max open trades
Two circuit breakers every EA should have, because bugs, gaps and bad days do not wait for you to notice.
5 minute read
The daily loss stop
Record equity at the start of each server day. If equity falls more than your limit (for example 3%) below it, open no new trades until tomorrow. Some traders also close everything at that point. This is the single most effective protection against a logic bug that opens trade after trade.
double dayStartEquity = 0;
int dayOfYear = -1;
bool DailyLossReached()
{
MqlDateTime now;
TimeToStruct(TimeCurrent(), now); // broker server time
if(now.day_of_year != dayOfYear)
{
dayOfYear = now.day_of_year;
dayStartEquity = AccountInfoDouble(ACCOUNT_EQUITY);
}
double lost = dayStartEquity - AccountInfoDouble(ACCOUNT_EQUITY);
return(lost >= dayStartEquity * InpDailyLossPercent / 100.0);
}
Max open trades
Cap how many positions the EA may hold at once. Several positions in the same direction on correlated symbols (EURUSD and GBPUSD, gold and silver) are close to one bigger position. Five trades at 1% each in the same direction is closer to one trade at 5%.
Weekly and overall limits
A larger, slower limit — such as stopping for the week after a set loss, or switching the EA off at a drawdown deeper than anything seen in testing — protects you from a regime the EA was never designed for.
Takeaways
- Stop new trades for the day after a set loss.
- Cap open positions; correlated trades add up.
- Add a hard switch-off level beyond tested drawdown.
Your rules, our teaching. MarketPanda provides no strategy, no settings that “work” and no signals. Everything here is education; nothing is a recommendation to trade.
Content source: Bundled MarketPanda content.