Loss Streak Cooldown Guard
- ユーティリティ
- バージョン: 1.0
- アクティベーション: 5
See it for yourself before anything else: load Loss Streak Cooldown Guard in the Strategy Tester with visual mode on, watch three small demo trades lose, watch the streak blocks fill up and the countdown start, then see the next demo trade closed the moment it opens.
THE FOURTH TRADE AFTER THREE LOSSES IS RARELY A GOOD ONE.
Loss Streak Cooldown Guard is a utility Expert Advisor for MetaTrader 5. It finds no entries and takes no trades for you. It counts your consecutive losing trades, and when the count reaches your limit it starts a timed cooldown. While the clock runs, any new position is closed at once or reported, as you choose. Whatever you held before the cooldown began stays exactly as it was. The first win resets the streak.
At a glance
• Cooldown of X minutes after N consecutive losing closed trades, with both numbers set by you.
• One position equals one trade: partial closes are added together and counted once, after swap, commission and fees.
• Streak and cooldown are rebuilt from your deal history, a design meant to keep a cooldown running through a terminal restart (see the testing note below).
• Two reactions for a new position during the cooldown: close it, or alert only.
• Optional delete of pending orders placed during the cooldown. Orders placed earlier are left alone.
• Streak meter with one block per loss, a live countdown with a shrinking bar, and a table of your last losses.
• Warning when one more loss would start the cooldown.
• Closes made by the guard are tagged and never counted as a new loss, so it cannot feed its own streak.
• Reacts on the trade event itself, with a one second timer behind it as a safety net.
• Scope by all symbols or chart symbol, and by any magic, one magic number or manual trades only.
• Built for hedging and netting accounts: on netting only the volume added during the cooldown can be removed (netting not tested yet, see the testing note below).
• Not a grid, no martingale, no averaging, no DLLs, no web requests, no extra files.
QUICK START
Attach it to one chart of any symbol, for example EURUSD H1, and turn on Algo Trading. One copy is enough, because the default scope is all symbols of the account. The default rule is 3 losses in a row followed by 60 minutes of cooldown, with new positions closed. The panel at once shows your current streak, because the guard reads your recent deal history when it starts. If that history already holds an active cooldown, it continues from where it stands. If you want to watch first, press the CLOSE button once so it reads ALERT ONLY, and trade normally for a few days.
Why a pause beats willpower
Most traders know the pattern. A stop is hit, then another, then a third. Nothing is wrong with the account yet, but the next decision is no longer calm: the entry comes sooner, the reason is thinner, the wish to win it back is louder. Rules written on paper are easiest to ignore at exactly that moment. A cooldown takes the decision out of that moment. You agree on the limit while you are calm, and the terminal holds you to it when you are not. The guard makes no claim about whether your next trade would have won or lost. It only gives you the time you asked for.
What sets it apart
History is the memory. Nothing important lives in memory or in a file. Every pass can replay the deals of the last days and arrive at the same streak and the same cooldown end, so closing and reopening the terminal is no way around your own rule.
A trade is a position. Closing a position in three parts is one trade with one result, not three, and a part that closes in profit does not hide a position that lost overall.
Honest counting. The close that the guard sends carries its own tag and its order ticket is remembered. A blocked trade usually costs the spread, and without this tag each blocked trade would look like one more loss.
No early exit button. ALLOW NEXT lets one position through when you have a real reason, but no button ends the cooldown. PAUSED stops the reaction, and doing that stays a visible, deliberate step.
The cost is shown. COST OF BLOCKS adds up what the guard's own closes cost today, so you see the price of the protection and can judge it.
One small warning first. When one more loss would start the cooldown, an alert says so and the banner turns amber, while you can still decide calmly.
How one streak plays out
1. Read. On every new deal, and at least once a minute, the deals of the lookback window are replayed in time order.
2. Group. All deals of one position form one trade. Its result is profit plus swap, commission and fees.
3. Count. A result below your minimum loss adds one to the streak. A result above zero resets it. A result in between changes nothing.
4. Start. When the streak reaches your limit, the cooldown starts at the time of that closing deal and runs for your number of minutes.
5. Guard. During the cooldown each position in scope is checked for volume added after the start. New volume is closed or reported, and older volume is never touched.
6. Finish. When the time is up the guard announces it, and by default the streak starts again from zero.
A win during a cooldown resets the streak but does not end the cooldown.
What counts as new
Every position is judged from its own deals. If a position has volume that entered after the cooldown started, that volume is new. On a hedging account a position opened during the cooldown is new as a whole. On a netting account, where a trade merges into the existing position, only the added lots can be removed and the older lots stay. If a netting position is reversed during the cooldown, the whole new side counts as new. A pending order placed earlier that fills during the cooldown is new volume too, because it entered the market during the pause. Because this rule uses deals, it works the same after a restart.
Inputs, every one explained
STREAK RULE
InpLosses = 3. How many consecutive losing trades start a cooldown, from 1 to 50.
InpCooldownMin = 60. Length of the cooldown in minutes, from 1 to 43200. It is clock time, so weekends and closed sessions count.
InpMinLoss = 0. A trade counts as a loss only if its result is below minus this amount in account currency. With 0 any net loss counts. Raise it to ignore tiny scratches, which then neither add to the streak nor reset it.
InpExtend = false. When true, each further loss during a cooldown, from a position that was already open, restarts the timer.
InpAfter = Streak starts again from zero. The second choice keeps the streak after the cooldown, so the very next loss starts a new cooldown at once, while a win resets it as usual.
InpLookbackDays = 30. How many days of deal history are replayed, from 1 to 365. A position opened before this window has no opening deal to read, so each of its closing deals counts on its own.
REACTION - WHAT HAPPENS DURING A COOLDOWN
InpAction = Close. Close removes the volume opened during the cooldown at market. Alert only changes nothing and sends the alert.
InpCancelPending = false. When true, pending orders placed during the cooldown are deleted. Older pending orders stay in place, and they are not restored or moved. If one of them fills during the cooldown, the fill is handled like any new position.
FILTER - WHICH TRADES ARE IN SCOPE
InpSymbolScope = All symbols. All symbols treats the account as one streak. Chart symbol only counts and guards the chart symbol alone.
InpMagicFilter = Any magic. Any magic includes manual and Expert Advisor trades, Only the magic number includes one Expert Advisor, Only manual trades includes magic 0. The magic of a trade is read from its opening deal, so a manual close of an Expert Advisor trade still belongs to that Expert Advisor.
InpMagic = 0. The number used when the filter is set to Only the magic number.
ALERTS
InpAlertPopup = true. Pop-up alert in the terminal.
InpAlertPush = false. Push notification to the MetaTrader app on your phone. Push must be enabled in the terminal options.
InpWarnOneAway = true. Alert when one more loss would start the cooldown.
PANEL
ShowPanel = true. Show or hide the panel. The guard keeps working with the panel hidden.
PanelX = 12 and PanelY = 15. Offset from the top left corner of the chart. The MOVE button lets you drag the panel anywhere.
PanelFontSize = 9. The base font size. The panel reduces it automatically on a small chart, so it fits.
MaxTableRows = 5. How many losses the table lists.
STRATEGY TESTER DEMO
InpTesterDemo = true. Only in the Strategy Tester: small trades of the minimum volume, opened after a margin check and closed once they show a loss, so that a streak and a cooldown appear on any symbol. During a cooldown one more demo trade opens so you can see it blocked. On a deposit too small for the minimum volume the demo is skipped, and it stops by itself after using 20 percent of the deposit. This never runs on a live or demo account chart.
The panel
LOSS STREAK shows one block per loss of your rule, with the count and the money lost in the streak. COOLDOWN shows the time left and a red bar that shrinks to nothing. GUARD SETTINGS lists the rule, what counts as a loss, what happens to a new trade and a new pending order, when the cooldown ends, positions and lots in scope, trades blocked today, the cost of those blocks, cooldowns today and the last action. LAST LOSSES lists time, symbol, side, lots, result, its number in the streak and a size bar. The banner gives the situation in one sentence. QUICK CONTROLS: ARMED or PAUSED switches the reaction, the action button changes between CLOSE and ALERT ONLY, ALLOW NEXT lets one position stand. The minus button folds the panel to its header. Nothing is drawn on the right side of the chart, and in a non-visual backtest no panel is drawn at all.
How to use it well
Start in ALERT ONLY and look at how often the rule would have fired. If it fires every day, the limit is too tight for your style. If it never fires, it protects nothing. A scalper with many small trades usually needs a higher count and a shorter pause, and a swing trader a lower count and a much longer one. If you run several Expert Advisors, decide whether one streak should stop them all, or use the magic filter and one copy per Expert Advisor. Check that each Expert Advisor can cope with a position being closed from outside, because it may simply try again, and each attempt pays the spread. Keep the terminal running, for example on a VPS, because the guard acts only while it runs.
Good to know
It cannot prevent losses already open. Positions open before the cooldown keep running, and they can still lose. It also cannot stop you from opening a trade: it reacts after the position exists, so a blocked trade has really been opened and closed, and the spread, commission and possible slippage are real costs. A close is a market order and can realise a loss. While the market for a symbol is closed the close waits for the session to open. If Algo Trading is off the guard only alerts. If the broker rejects a close, the failure shows in red on the panel, goes to the journal and is tried again every few seconds. While the terminal is off nothing is closed, and a position opened from your phone during that time is handled when the terminal returns, if the cooldown is still running. The guard never opens trades outside the Strategy Tester, never moves stops or targets and never reopens what it closed.
Removing the Expert Advisor stops the guard, which is your right, and the panel does not pretend otherwise. PAUSED, ALERT ONLY mode and ALLOW NEXT are kept in memory and return to normal after a restart. The blocks and alerts counted by the panel for today partly live in memory too: closed trades are rebuilt from history, while alert and pending counts start again after a restart. If a broker replaces the comments on closing orders, a guard close made before a restart could be counted as a normal trade after that restart.
What was and was not tested
Testing was done in the Strategy Tester on EURUSD H1 and XAUUSD H1, where cooldowns started and ended, demo trades were closed and the optional delete of pending orders ran. Not tested at the time of writing: a real terminal restart during a cooldown, a netting account, a real or demo broker account with live closes, push notifications, and a reversal of a netting position. A restart was only reasoned through the same history replay that the tester runs repeatedly. Please try these on a demo account with your own broker before you depend on them.
Try it in the Strategy Tester
Choose Loss Streak Cooldown Guard, any symbol, visual mode and press Start. The demo trades will build a streak, the blocks will fill, the countdown will start and the next demo trade will be closed, with each step printed in the journal. Then change the number of losses or the minutes, or switch to alert only, and compare what happens.
If Loss Streak Cooldown Guard gave you a pause when you needed one, or you see something it should do better, an honest review on the product page helps other traders decide and tells me what to improve next.
