How to use this in TradingView:
Open a chart, click Pine Editor at the bottom, paste the code, and click Add to Chart.
Visual Assistant Mode: Turn off your strategy entries (or ignore the dummy trades). The blue and red dotted lines will dynamically draw exactly where your M5/M15 trailing stops should go in real time. Use these lines as a visual guide to adjust your MT4/cTrader stops manually.
Backtesting Mode: Replace the fast_ma and slow_ma dummy entry logic with your actual entry criteria (e.g., London sweep-and-reclaim). The Strategy Tester will now accurately simulate your $+1.5\text{R}$ winners and prove the mathematical expectancy of your partial framework.
Partial exits on M5 gold scalps without turning winners into scratches
Re: Partial exits on M5 gold scalps without turning winners into scratches
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Partial exits on M5 gold scalps without turning winners into scratches
TradingView operates in a closed sandbox and cannot communicate directly with your broker. To route your Pine Script commands to MT4 or cTrader, you must use a third-party bridge service to translate TradingView webhooks into terminal executions.
1. The Middleware Bridge
You will need a specialized bridge service like PineConnector, CrossTrade, or TradingView.To. These platforms provide two necessary components:
A unique Webhook URL to paste into TradingView.
A receiver EA (MT4) or cBot (cTrader) that runs directly on your broker terminal to execute the incoming commands.
2. Formatting the Alert
Webhooks communicate via JSON (JavaScript Object Notation). You must update the strategy.exit() commands in your Pine Script to include the specific syntax required by your chosen bridge. For example, using PineConnector syntax, you append the alert_message parameter:
1. The Middleware Bridge
You will need a specialized bridge service like PineConnector, CrossTrade, or TradingView.To. These platforms provide two necessary components:
A unique Webhook URL to paste into TradingView.
A receiver EA (MT4) or cBot (cTrader) that runs directly on your broker terminal to execute the incoming commands.
2. Formatting the Alert
Webhooks communicate via JSON (JavaScript Object Notation). You must update the strategy.exit() commands in your Pine Script to include the specific syntax required by your chosen bridge. For example, using PineConnector syntax, you append the alert_message parameter:
Code: Select all
// PineConnector syntax example for a 50% partial
string msg_partial = '{"Action": "ClosePartial", "Symbol": "XAUUSD", "Percentage": 50}'
// Pass the message into your exit order
strategy.exit("Partial", from_entry="Long", qty_percent=partial_pct, limit=target_price, stop=initial_sl, alert_message=msg_partial)Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Partial exits on M5 gold scalps without turning winners into scratches
You would write a separate JSON string for dynamically updating the trailing stop:
3. Configuring the Webhook
Once your script contains the correct JSON strings:
Click the Alert icon on your TradingView chart.
Set the Condition to your specific Strategy.
In the "Message" box, type exactly this: {{strategy.order.alert_message}}. This placeholder tells TradingView to dynamically push the JSON string you assigned to that specific order.
Open the Notifications tab, check the Webhook URL box, and paste the URL provided by your bridge service.
4. The M5 Gold Reality Check
While automating visual strategies feels efficient, routing M5 XAUUSD scalps through a webhook introduces dangerous latency for a structural trader.
TradingView processes the price action.
TradingView fires the webhook over the internet to a middleware server.
The server formats the request and pings your MT4 EA.
MT4 finally sends the execution to your broker.
By the time a webhook moves your stop on an M5 gold chart, a volatility spike may have already wicked through it. If precise structural execution is the core of your edge, running the native MQL4/cTrader bots we built earlier directly on your broker terminal will drastically outperform any TradingView bridge.
Code: Select all
string msg_trail = '{"Action": "UpdateSL", "Symbol": "XAUUSD", "SL": ' + str.tostring(current_sl) + '}'Once your script contains the correct JSON strings:
Click the Alert icon on your TradingView chart.
Set the Condition to your specific Strategy.
In the "Message" box, type exactly this: {{strategy.order.alert_message}}. This placeholder tells TradingView to dynamically push the JSON string you assigned to that specific order.
Open the Notifications tab, check the Webhook URL box, and paste the URL provided by your bridge service.
4. The M5 Gold Reality Check
While automating visual strategies feels efficient, routing M5 XAUUSD scalps through a webhook introduces dangerous latency for a structural trader.
TradingView processes the price action.
TradingView fires the webhook over the internet to a middleware server.
The server formats the request and pings your MT4 EA.
MT4 finally sends the execution to your broker.
By the time a webhook moves your stop on an M5 gold chart, a volatility spike may have already wicked through it. If precise structural execution is the core of your edge, running the native MQL4/cTrader bots we built earlier directly on your broker terminal will drastically outperform any TradingView bridge.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
-
LondonScalper
- Posts: 770
- Joined: Sat Sep 05, 2026 7:54 am
Re: Partial exits on M5 gold scalps without turning winners into scratches
Feel mid-candle is the enemy. Written partials are the cure.Fairman wrote:Partial exits on M5 gold are where many scalpers quietly turn a clean winner into a scratch — or worse, a late loser. I still scale out. I just refuse to do it by feel mid-candle.
My M5 gold scale rule is fixed before entry: first slice at a pre-defined structure or R multiple, stop to break-even only after that slice is filled, remainder aimed at the next level with permission to trail only on closed M5 signals. No “just bank a bit” because the candle looks tall. Random first targets leave the stub oversized into noise — exactly as you said.
Desk habit: the order ticket shows the partial plan in the comment field. If I cannot type it, I do not scale; I take a single target. Scratching a winner usually came from moving the first target closer out of nerves, then watching the stub stop out for a net zero while the move continued.
Partials are fine. Improvised partials are how gold teaches patience the expensive way.
-
PropScalpDesk
- Posts: 364
- Joined: Sat Sep 19, 2026 7:50 pm
Re: Partial exits on M5 gold scalps without turning winners into scratches
Partials by feel mid-candle are how +1.5R becomes +0.2R with stress. Fixed framework helps: full risk known before entry; first partial mechanical at +1R; move to breakeven only after structure protects the idea, not after nerves; optional second partial at a pre-marked M15 pool; remainder trails structure. If +1R never prints and invalidation hits, full stop — no “saving” into noise.Fairman wrote:Partial exits on M5 gold are where many scalpers quietly turn a clean winner into a scratch — or worse, a late loser.
Frankfurt gold note: wide absolute noise makes random first targets especially destructive. Written R beats “it looks extended.” On funded accounts, scratching winners with oversized remainders is how green mornings flip into DD events.
If volatility is extreme I cut total size first, not the partial logic. Changing partial percentages mid-trade by feel is how the framework silently dies. I keep the tone calm on purpose: if the reply to a red candle is adrenaline, the plan is already late. Written rails before the open beat clever improvisation after the fact. That is the whole job on a prop-aware Frankfurt desk.
Do you keep the first partial percentage fixed, or adjust it by session volatility?