거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

Daily loss and max loss guard - prop firm rules in one include - MetaTrader 5용 라이브러리

Lukas Szyry
Lukas Szyry
Gold Trading Specialist | XAUUSD Expert Advisors
MetaTrader 5용 금(XAUUSD) 규칙 기반 Expert Advisor를 개발합니다. 장기적인 계좌 성장을 위한 견고한 시스템에 집중합니다: 마틴게일 없음, 그리드 없음, 손실 시 물타기 없음.
모든 업데이트는 출시 전에 2010년부터 현재까지 XAUUSD 실제 틱 데이터로 아웃오브샘플 기간을 포함하여 테스트됩니다. 기존 사용자에게 업데이트는 항상 무료입니다.
조회수:
31
게시됨:
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Most prop firm accounts are not lost by a bad strategy but by one bad day. The daily loss rule counts the floating loss too, and it counts from the start of the day, not from your last trade. A stop-loss on every trade does not help if three trades go wrong in the same morning.

This include does the counting for you and acts before the firm does:

  • daily limit in % of the initial balance (prop style) or of the day start
  • day start = balance, or the higher of balance and equity at the reset hour
  • max limit static (initial balance) or trailing (highest equity seen)
  • warning level: from e.g. 80 % of the daily limit no new trades until the next day
  • breach: closes all positions, deletes pending orders, blocks until the next day (daily) or until Reset() (max)
  • all values are kept in global variables of the terminal, so a restart in the middle of the day does not forget the day start or a breach
  • guard the whole account (magic -1) or only one EA
LS_EquityGuard guard;
guard.Init(5.0, 10.0);            // OnInit: 5 % daily, 10 % max, prop defaults
guard.Update();                   // OnTick and/or OnTimer
if(guard.CanOpen()) ...           // false after warning level or breach
guard.RoomMoney()                 // money left until the nearest limit
guard.Fits(riskMoney)             // would a full stop-loss still stay above both limits?
guard.StatusText()                // one line for the journal or Comment()

Set your limits a bit tighter than the rule of your firm: the price can jump between two ticks and the close happens on the next one. In the real tick test below the overshoot was between 0.07 and 10.27 USD on a 10,000 USD account.

The demo EA works as an account guard on a live or demo account: attach it to any chart, it opens no trades and checks once per second. Only in the strategy tester "Test lots" opens one buy per day without a stop-loss, so you can watch the guard work. The screenshot: XAUUSD real ticks October 2026, 10,000 USD, 0.3 lot per day - three daily stops, then the max stop, after that every test trade is skipped.

LS_EquityGuard_Demo journal, XAUUSD real ticks

Return-to-Mean Clock: How Many Bars Does Price Take to Come Back to the Moving Average Return-to-Mean Clock: How Many Bars Does Price Take to Come Back to the Moving Average

Measures how long price takes to come back to its moving average. The histogram shows the distance of the close from an EMA in ATR. Every time that distance first reaches a stretch level (1, 2 and 3 ATR by default), the indicator follows the stretch until the close is back at the average, runs further, or the wait is over. A panel shows, for each level, how often price came back, how often it ran further first, and the median and 80th-percentile number of bars the return took. One line can be pasted into a comment to compare symbols. It is a statistics tool and gives no trade signals.

Prop Firm Risk Manager - daily loss and trailing drawdown guard Prop Firm Risk Manager - daily loss and trailing drawdown guard

Account guard for prop-firm challenges. It does not open trades: it watches the whole account (manual trades and any EA) and closes everything before the firm's limits are broken. - Daily loss limit: closes all and blocks trading until the next day. - Max drawdown: static or trailing (can lock at the start balance); closes all and locks the account. - Optional profit-target lock, max lots / max positions, Friday close. - On-chart panel (equity, today's P/L, daily and drawdown room left) and push alerts. - Equity peak and lock are saved per account, so a restart does not reset the protection. Main inputs: StartBalance, DailyLossUSD, DDMode, MaxDDUSD, LockAtStart, safety buffers, TargetUSD, MaxOpenLots, MaxOpenPositions, FridayCloseOn, ResetLock. Attach to any one chart, any symbol and timeframe, with Algo Trading enabled.

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.