Risk Lock Trade Panel
- Utilities
- Version: 1.0
- Activations: 10
Risk Lock Trade Panel is a manual trading panel for MetaTrader 5. You decide the direction and the entry. The panel does the arithmetic, sends the order with its stop already attached, and manages the position from the same window.
It does not open trades on its own, it does not give advice, and it does not send signals.
SIZE EVERY ORDER FROM YOUR RISK
Enter your risk as a percentage of balance or equity, or as a fixed amount in your account currency. Set the stop distance in points, or press "Show line" and drag the stop line on the chart. As you drag, the distance, the lot and the money at risk are recalculated on every move.
Put the stop close and the lot grows. Put it far and the lot shrinks. The money at risk stays where you set it. That is the point of the panel: you choose where the stop belongs on the chart, and the size follows.
A risk-reward preset places the TP at a multiple of your stop distance - one to one, one to one and a half, one to two, or none at all. Pick one and it is attached to the order together with the stop.
The lot is normalised to the symbol: volume step, minimum and maximum volume are read from the broker, and the loss of one lot at your stop distance is calculated by MetaTrader itself, so currency pairs, gold, indices and other CFDs are all handled from the same panel. After rounding, the panel checks the result once more and steps the lot down if it would exceed the risk you asked for. It never sends a lot larger than your setting. If the result falls below the minimum lot, or is capped at the maximum, the panel says so before you press anything.
A STOP ON THE WRONG SIDE CANNOT BE SENT
If the stop line sits below price, only BUY is available. If it sits above price, only SELL is available. The other button is switched off and the panel tells you why. Every disabled button carries its reason: algo trading is off, the spread is wider than your limit, the stop is not set, there is not enough margin, or the stop is closer than the broker allows.
MANAGE THE POSITION FROM THE SAME WINDOW
When a position is open, the panel changes to position mode. Close all, close buy, close sell, close half, move the stop to entry with an optional offset, and switch trailing on or off. Close all asks for a second click within three seconds, which you can turn off. By default the closing buttons act only on the positions this panel opened; you can widen that to every position on the symbol, and the current setting is shown on the panel at all times.
A DAILY OR TOTAL LOSS LIMIT THAT STOPS NEW ENTRIES
Set a daily limit, a total limit, or both. Commission and swap are included, and you choose whether the floating result of open positions is counted. The panel shows which basis it is using at all times. At eighty percent of the limit the panel warns you. At the limit, BUY and SELL switch off and stay off until the trading day resets, or until you release a total limit yourself.
Your open positions are not touched. Close all, close half, stop to entry and trailing all keep working. The limit stops you from starting something new, it does not lock you out of what you are already in.
There is an option to close positions and keep new ones closed when a limit is crossed. It is off by default, and it stays off unless you turn it on.
The total limit can be measured from the balance at the start of the day or from the account high watermark, whichever you prefer.
Releasing a limit takes two clicks on "Reset limit", and it does exactly what it says: counting starts again from that moment, so the same figure does not lock the panel again a second later. Every release is written to the log.
Deposits and withdrawals made during the day are recognised and removed from the day's starting balance, so money moved in or out is not read as a result.
SETTINGS THAT SURVIVE THE CHART
Risk, stop distance, risk-reward preset, stop line position, panel position, folded state, trailing, spread limit and closing scope are stored per symbol and per account, in a file. Change the timeframe, reopen the chart or restart the terminal and they are still there, and they also survive a terminal that closes unexpectedly. Gold and EURUSD keep their own values.
The panel is dragged by its header and folds to a single line. It stays inside the chart when the chart is resized or tiled.
ACCOUNT MODE
This panel is built for hedging accounts, and that is where it was developed and tested.
It also reads your account mode at start-up and adapts to netting: there is one position per symbol, so close buy and close sell are not shown, close half reduces the net position, and an order in the opposite direction is announced as a reduction before it is sent. That adaptation has not yet been confirmed on a live netting account, so run the free demo there first.
WHAT IT DOES NOT DO
- It does not open trades by itself, choose entries, or send trading signals.
- It does not give advice and makes no claim about results.
- It cannot stop an order placed somewhere else. Orders from another Expert Advisor, from the mobile app or from a second terminal are outside its reach. The limit switches off this panel's buttons; it does not switch off your account.
- It cannot share a chart with another Expert Advisor. MetaTrader 5 allows one Expert Advisor per chart, so the panel needs a chart of its own.
- It cannot trade while algo trading is off. The panel keeps displaying and tells you why the buttons are inactive.
- Version 1.00 sends market orders. Pending orders are not placed from the panel.
- Slippage, requotes and broker-side restrictions are not under its control. Every send result, including the error code, is shown on the panel and written to the log.
TRYING IT IN THE STRATEGY TESTER
The free demo runs in the Strategy Tester. Open it in visual mode and the panel is drawn on the chart, so you can see the layout, the risk and stop fields, the calculated lot and the two limit rows before you decide. The loss limit works there against the tester's virtual balance, which is not the same as your own account balance. The panel was built and checked for real use on a chart, and that is where the buttons, the stop line and the exits belong; a demo account is the honest way to try those.
INPUTS
All inputs have working defaults. You can attach the panel and use it without changing anything.
Trading: InpMagic (20280001), InpComment (RiskLockPanel), InpSlippagePoints (20), InpMaxSpreadPoints (50, 0 = no limit), InpRiskMode (Percent or Fixed money), InpRiskBase (Balance or Equity), InpDefaultRiskPct (1.0), InpDefaultRiskMoney (100.0), InpDefaultStopPoints (200).
Loss limit: InpUseDailyLimit (true), InpDailyLimitPct (3.0), InpUseTotalLimit (false), InpTotalLimitPct (10.0), InpLimitAnchor (Balance at day start or High water mark), InpDayResetHour (0), InpCloseOnBreach (false), InpIncludeFloating (true).
Exit and trailing: InpCloseScope (This panel only or All positions on symbol), InpConfirmCloseAll (true), InpConfirmSeconds (3), InpBreakevenOffsetPts (0), InpTrailingPoints (200), InpTrailingStartPoints (-1 = same as distance), InpTrailingStepPoints (10).
Risk-reward presets: InpRRPreset1 (1.0), InpRRPreset2 (1.5), InpRRPreset3 (2.0).
Panel: InpPanelX (20), InpPanelY (20), InpFont (Arial), InpFontSize (8), and ten colour inputs for the background, header, text, read-only values, buttons, buy, sell, active, disabled and warning states.
Stop line: InpShowStopLine (true), InpLineColor, InpLineStyle, InpLineWidth.
NO EXTERNAL DEPENDENCIES
No DLL, no external website or API, no third-party server, and nothing is collected from your terminal. Everything runs inside MetaTrader 5.
PLEASE NOTE
Trading foreign exchange and CFDs carries a risk of loss. This panel is an execution and calculation aid. It does not provide trading advice or signals and makes no claim about trading results. The lot it calculates follows the figures you enter; it is not a recommendation. All trading decisions and their outcomes are your own.
