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

Basket Protective Close - MetaTrader 5용 expert

Judi Gosal
Judi Gosal
MQL5 developer from Indonesia. Trading since 2020 and writing my own MT5 code since then.
조회수:
283
평가:
(1)
게시됨:
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Closes a basket of positions the moment its floating loss reaches a limit you set.

The limit can be a fixed amount of money, a percent of balance, or a percent of equity. Percent is the mode I recommend: a fixed 1000 USD limit means one thing on a 10k account and something very different on 200k, and on a large basket spread and swap alone can eat a fixed figure before the market even moves. A percent limit keeps its meaning as the account changes.

You decide what counts as the basket: every position on the account, only the chart symbol, or a list of magic numbers, so you can guard one specific EA and leave the rest alone. Magic 0 covers manual trades.

There is also an optional profit target: close the same basket when its floating profit reaches a fixed amount or a percent of balance. Off by default.

How it closes: at the moment of trigger the utility takes a snapshot of the basket and only ever closes those tickets, so positions that other EAs open seconds later are never touched. It retries failed closes on a half second timer without blocking the terminal, picks the right filling mode per symbol, and verifies every close against the server return code instead of trusting the send. The retry budget is only spent on real rejections: while the connection is down, autotrading is off, or the market is closed, it waits instead of giving up. If the server keeps rejecting for 40 sweeps it stops, alerts you, and leaves the account to you instead of hammering the server forever.

After a trigger it either re-arms or stops monitoring, your choice. To re-arm after any stop, change any input and press OK. Alert window and push notification are supported, and the chart shows a small status panel with the current basket, the limit, and the distance to it.

One safety rule at attach: if the floating loss is already beyond the limit at the moment you attach the utility, it starts disarmed and tells you so, instead of liquidating the account the second it loads. Review the inputs and press OK to arm it.

Input parameters:

  • Loss limit type: fixed money, percent of balance, or percent of equity.
  • Loss limit value: the amount or the percent, depending on the type. Default 2.0 percent of balance.
  • Profit target type and value: optional basket take profit in money or percent of balance. Off by default.
  • Scope: all positions, current chart symbol only, or magic numbers from the list.
  • Magic numbers: comma separated list, 0 means manual trades. Used only with the magic scope.
  • Stop monitoring after first trigger: one shot mode. Off by default, the utility re-arms.
  • Max deviation on close: slippage allowance in points for close orders. Default 20.
  • Alert window and push notification: how the trigger is reported.

Symbol and timeframe: attach to one chart of any symbol and any timeframe. The monitoring runs on a timer, the chart only hosts the panel. With the account scope it guards every symbol from that single chart.

Notes:

  1. Floating result is position profit plus swap. Deal commission is not visible on an open position in MT5, so on raw spread accounts set the limit with commission in mind.
  2. Run one instance per basket. Two instances guarding overlapping baskets will race each other.
  3. Works on hedging and netting accounts. It needs a running terminal, so put it on a VPS if the protection matters.

I wrote this after analyzing a grid EA from its trade history and finding that its fixed money protective close could never work at the lot sizes involved. This is the version I wanted to hand over instead.

Basket Protective Close panel and trigger alert

Swing Detector by Pullback (Smart Money Concepts) Swing Detector by Pullback (Smart Money Concepts)

SMC Pullback marks swing highs and lows using the pullback definition instead of the usual 3-candle pattern. A high is confirmed only when price trades back through the low of the candle that made it — so every marked point is an actual rejection, and highs and lows always alternate. It evaluates closed bars only and never moves a marker once drawn, so it does not repaint. Two buffers expose the confirmed swing prices to an EA via iCustom.

Hurst Exponent Regime Switch Indicator Hurst Exponent Regime Switch Indicator

Estimates the rolling Hurst exponent of price via rescaled-range (R/S) analysis and plots it as a color-coded oscillator that flags whether the market is currently trending, mean-reverting, or moving like a random walk.

Timer Candle Timer Candle

simple coundown timer

Drawdown Meter Drawdown Meter

Most reports give you one drawdown number - the worst one. This read-only script measures all three that matter on your own closed history: depth, duration and frequency. It prints the maximum drawdown with its peak, trough and recovery dates, the longest underwater period in days, whether you are at a new peak or how far below it and for how long, and a table of the deepest episodes with the days each took to recover. An episode is not a losing streak: it closes only when a NEW high is made, so a dip that never reclaims the old peak stays the same episode - which is what makes the duration column meaningful. Entry commissions are included and a partial close counts as one round turn, so the curve carries full cost. Optional percentage figures and CSV export. Deposits and withdrawals are excluded: this is the drawdown of your trading, not of your balance line.