Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Experts

Daily Loss Limit Guard - close all and stay flat after the daily limit - expert for MetaTrader 5

Saad Ferdi
Saad Ferdi
MQL5 and Python developer focused on gold and forex.
I build and fix MT5 Expert Advisors and indicators, with clean source code and clear input settings.
Views:
28
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Daily Loss Limit Guard is a small Expert Advisor that enforces one rule: no more than X% lost in a day. It is useful for prop-firm challenges and for anyone who wants a hard stop after a bad day.

It watches the whole account (all symbols, manual trades and trades from any other EA) and never opens a trade itself.

How it works

  • At the daily reset hour (broker server time) it records the balance as the day-start balance.
  • Today's loss = day-start balance minus current equity, so open (floating) losses count too.
  • When the loss reaches the limit minus a buffer (10% of the limit by default), it closes every position and deletes every pending order.
  • For the rest of the day the account is kept flat: any new position, manual or from another EA, is closed at once. The lock ends at the next daily reset.
  • The day-start balance and the lock are saved in terminal global variables, so a terminal restart does not reset them.
  • Two status lines on the chart show OK or LOCKED, today's result, the limit and the day-start balance.

Inputs

  • InpLimitPct (3.0) - daily loss limit in % of the day-start balance.
  • InpLimitMoney (0) - a fixed daily limit in account currency; overrides the % when above 0.
  • InpResetHour (0) - hour of the daily reset, server time.
  • InpBufferPct (10) - act this % of the limit before the limit, to leave room for slippage while closing.
  • InpAlert (true) - pop-up alert when the limit is reached.

Notes

  • Attach it to one chart only and allow Algo Trading. It can only act while the terminal is running.
  • Prop firms measure the daily loss in different ways; check your firm's rules before relying on it.
  • The picture is an illustration of the rule.
  • A version with max loss (static or trailing), a daily profit lock, push alerts and a full panel is available in the Market as Prop Shield Drawdown Guard.
Break-Even Stop Mover with Locked Profit Break-Even Stop Mover with Locked Profit

Moves the stop loss of open positions to break-even plus a small locked profit once they reach a profit trigger. Works on manual trades and on trades from any other EA (magic filter). Never opens or closes trades and never moves a stop backwards.

Candle Streak Statistics: What Happens After N Same-Color Bars Candle Streak Statistics: What Happens After N Same-Color Bars

Counts run of bars of the same color and measures what the next bar did after a run of every length: how often the run continued, how often it reversed, and how far the next bar moved in ATR. The figures are built from the history of your own symbol and timeframe, each row is compared with the share of bars of that color, and the histogram shows the length of the run at every bar. A panel gives the table and one line that can be pasted into a comment to compare symbols.

Inside-Bar Outcome Tracker: Breakout Direction, Failure Rate and Time to Resolve Inside-Bar Outcome Tracker: Breakout Direction, Failure Rate and Time to Resolve

Finds every inside-bar pattern in the history of your chart and follows it to the end: which side of the mother bar broke first, whether the breakout held or failed within a few bars, and how many inside bars came before it. The histogram marks each breakout, boxes show the patterns on the chart, and a panel gives the statistics for your own symbol and timeframe, split by the number of inside bars and by the size of the mother bar, plus one line that can be pasted into a comment to compare symbols.

MACD Signals MACD Signals

Indicator edition for new platform.