PROTECTED SOURCE SCRIPT
已更新 Master Arb Recipes – 3 Commas signal Bot integration

Master Arb Recipes – 3 Commas signal Bot integration
Purpose
A systematic arbitrage/accumulation framework with pre-tuned “recipes” for BTC/ETH/XRP/SUI/SOL plus a fully manual mode. It automates signal generation for external execution bots (via alert() JSON), while showing on-chart panels for goals, active parameters, DCA position, and P&L/ROI/CAGR. Backtests simulate market orders with optional slippage and TradingView commissions.
Key ideas
Entries: Intrabar trigger when price drops by the recipe’s Entry drop % from the previous close.
Exits: Profit-taking when price rises by the recipe’s Exit rise % (optionally requiring price above average cost).
DCA accounting: Tracks running quantity, average cost, realized (cash) P&L, and unrealized (coin) P&L.
Capital planning: “ReqCap” column estimates capital = Entry $ × Allowed entries (UI only; does not affect orders).
Alerts (live only): Sends minimal Custom Signal JSON for enter_long / exit_long to your execution bot.
What’s included on chart
Top-Right: Strategy Goals Table
Describes the objective for each preset. Auto-filters by the chart’s base (optional).
Bottom-Left: Active Recipe Panel (with 3C UI column)
Shows the active preset (or custom) with: timeframe, Sell-Above-Cost state, Entry/Exit %, Exit-as-%-of-Entry, min bars between entries, once-per-bar gate, and 3Commas UI guidance for optional filters and per-order dollars.
Top-Left: DCA Panel
Current base quantity, average cost, and realized P&L.
Bottom-Right: P&L + ROI/CAGR Panel
Cash P&L (realized), Coin P&L (unrealized), Total P&L, ROI since first fill, and annualized CAGR. Displays denominators for both StartCap (strategy.initial_capital) and ReqCap (planning).
Presets
BTC: STH1_D, LTH1_6H, LTH2_D, LTH3_W, LTH4_6H
ETH: STH1_D, STH2_D, LTH1_D
XRP: STH1_D, STH2_6H, LTH1_6H, LTH2_1H
SUI: STH1_D, STH2_D, STH3_D
SOL: STH1_D, LTH1_D
Each preset sets Entry drop %, Exit rise %, default Entry $, Exit-as-%-of-Entry, Sell-Above-Cost flag, and a reference timeframe (display only). Custom mode lets you define these manually.
Inputs you’ll use
3Commas Custom Signal: secret, bot_uuid, max_lag_sec.
Start Window: Exact date/time + timezone to begin trading/signals.
Entry/Exit Parameters: Entry drop %, Exit rise %, Sell Above Avg Cost toggle, Exit as % of Entry.
Capital Planning: Allowed entries (for ReqCap), Entry $ override (panel only).
Execution/Sim: Simulated slippage %, once-per-bar gate, minimum bars between entries, TradingView commission.
Panels: Toggles + positions for each table.
Alert / Bot integration
Alerts fire only in realtime (barstate.isrealtime) on order submission.
Create one alert on this script using “Any alert() function call”.
Payload (Custom Signal style) includes:
secret, bot_uuid, max_lag, timestamp, trigger_price, tv_exchange, tv_instrument, action where action ∈ {enter_long, exit_long}.
Sizing: This script does not include per-order sizing in the JSON; size in your bot UI. The on-chart Entry $ / Exit $ values are for planning/backtest display.
3Commas optional filter mapping (shown in the panel’s “3C UI” column):
Entry filters:
Same order: set to –EntryDrop% (ON)
From average entry: set to –EntryDrop% (ON)
Exit filters:
If Sell Above Cost = ON → From average entry +ExitRise% (ON); Same order OFF
If Sell Above Cost = OFF → Same order +ExitRise% (ON); From average entry OFF
Per-order volume: Use your bot’s UI. Panel shows the dollars you planned (Entry $ and Exit $).
Backtest notes & limitations
Uses calc_on_every_tick=true and intrabar checks against the previous close for entry drops; historical behavior won’t perfectly match exchange microstructure.
process_orders_on_close=false; fills are simulated at bar prices with your slippage setting and TV commission.
Alerts and webhook timing depend on TradingView + broker/exchange latencies; use max_lag_sec accordingly.
Required Capital (ReqCap) is for planning only and does not reserve funds or constrain orders.
Recommended markets/timeframes
Crypto spot or futures charts that trade 24/7. Preset labels (D/6H/1H/W) are reference rhythms for volatility; the script runs on any timeframe but results will vary.
Change log (04092025)
Added 3C UI guidance column in Active Recipe panel (dynamic % per recipe).
Restored Goals (top-right) and P&L/ROI/CAGR (bottom-right with StartCap & ReqCap).
Minor UI clarifications; trading logic unchanged.
Disclaimer
This script is for research and education. It is not financial advice and makes no performance promises. Backtests are hypothetical and subject to substantial limitations. Markets involve risk; you can lose capital. Test on paper first and deploy at your own discretion. Licensed under the Mozilla Public License 2.0.
Purpose
A systematic arbitrage/accumulation framework with pre-tuned “recipes” for BTC/ETH/XRP/SUI/SOL plus a fully manual mode. It automates signal generation for external execution bots (via alert() JSON), while showing on-chart panels for goals, active parameters, DCA position, and P&L/ROI/CAGR. Backtests simulate market orders with optional slippage and TradingView commissions.
Key ideas
Entries: Intrabar trigger when price drops by the recipe’s Entry drop % from the previous close.
Exits: Profit-taking when price rises by the recipe’s Exit rise % (optionally requiring price above average cost).
DCA accounting: Tracks running quantity, average cost, realized (cash) P&L, and unrealized (coin) P&L.
Capital planning: “ReqCap” column estimates capital = Entry $ × Allowed entries (UI only; does not affect orders).
Alerts (live only): Sends minimal Custom Signal JSON for enter_long / exit_long to your execution bot.
What’s included on chart
Top-Right: Strategy Goals Table
Describes the objective for each preset. Auto-filters by the chart’s base (optional).
Bottom-Left: Active Recipe Panel (with 3C UI column)
Shows the active preset (or custom) with: timeframe, Sell-Above-Cost state, Entry/Exit %, Exit-as-%-of-Entry, min bars between entries, once-per-bar gate, and 3Commas UI guidance for optional filters and per-order dollars.
Top-Left: DCA Panel
Current base quantity, average cost, and realized P&L.
Bottom-Right: P&L + ROI/CAGR Panel
Cash P&L (realized), Coin P&L (unrealized), Total P&L, ROI since first fill, and annualized CAGR. Displays denominators for both StartCap (strategy.initial_capital) and ReqCap (planning).
Presets
BTC: STH1_D, LTH1_6H, LTH2_D, LTH3_W, LTH4_6H
ETH: STH1_D, STH2_D, LTH1_D
XRP: STH1_D, STH2_6H, LTH1_6H, LTH2_1H
SUI: STH1_D, STH2_D, STH3_D
SOL: STH1_D, LTH1_D
Each preset sets Entry drop %, Exit rise %, default Entry $, Exit-as-%-of-Entry, Sell-Above-Cost flag, and a reference timeframe (display only). Custom mode lets you define these manually.
Inputs you’ll use
3Commas Custom Signal: secret, bot_uuid, max_lag_sec.
Start Window: Exact date/time + timezone to begin trading/signals.
Entry/Exit Parameters: Entry drop %, Exit rise %, Sell Above Avg Cost toggle, Exit as % of Entry.
Capital Planning: Allowed entries (for ReqCap), Entry $ override (panel only).
Execution/Sim: Simulated slippage %, once-per-bar gate, minimum bars between entries, TradingView commission.
Panels: Toggles + positions for each table.
Alert / Bot integration
Alerts fire only in realtime (barstate.isrealtime) on order submission.
Create one alert on this script using “Any alert() function call”.
Payload (Custom Signal style) includes:
secret, bot_uuid, max_lag, timestamp, trigger_price, tv_exchange, tv_instrument, action where action ∈ {enter_long, exit_long}.
Sizing: This script does not include per-order sizing in the JSON; size in your bot UI. The on-chart Entry $ / Exit $ values are for planning/backtest display.
3Commas optional filter mapping (shown in the panel’s “3C UI” column):
Entry filters:
Same order: set to –EntryDrop% (ON)
From average entry: set to –EntryDrop% (ON)
Exit filters:
If Sell Above Cost = ON → From average entry +ExitRise% (ON); Same order OFF
If Sell Above Cost = OFF → Same order +ExitRise% (ON); From average entry OFF
Per-order volume: Use your bot’s UI. Panel shows the dollars you planned (Entry $ and Exit $).
Backtest notes & limitations
Uses calc_on_every_tick=true and intrabar checks against the previous close for entry drops; historical behavior won’t perfectly match exchange microstructure.
process_orders_on_close=false; fills are simulated at bar prices with your slippage setting and TV commission.
Alerts and webhook timing depend on TradingView + broker/exchange latencies; use max_lag_sec accordingly.
Required Capital (ReqCap) is for planning only and does not reserve funds or constrain orders.
Recommended markets/timeframes
Crypto spot or futures charts that trade 24/7. Preset labels (D/6H/1H/W) are reference rhythms for volatility; the script runs on any timeframe but results will vary.
Change log (04092025)
Added 3C UI guidance column in Active Recipe panel (dynamic % per recipe).
Restored Goals (top-right) and P&L/ROI/CAGR (bottom-right with StartCap & ReqCap).
Minor UI clarifications; trading logic unchanged.
Disclaimer
This script is for research and education. It is not financial advice and makes no performance promises. Backtests are hypothetical and subject to substantial limitations. Markets involve risk; you can lose capital. Test on paper first and deploy at your own discretion. Licensed under the Mozilla Public License 2.0.
發行說明
Change default cooldown bars from 1 to 0受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。