OPEN-SOURCE SCRIPT

Bot Analyzer

73
📌 Script Name: Bot Analyzer

This TradingView Pine Script v5 indicator creates a dashboard table on the chart that helps you analyze any asset for running a martingale grid bot on futures.

🔧 User Inputs

TP % (tpPct): Take Profit percentage.

SO step % (soStepPct): Step size between safety orders.

SO n (soCount): Number of safety orders.

M mult (martMult): Martingale multiplier (how much each next order increases in size).

Lev (leverage): Leverage used in futures.

BB len / BB mult: Bollinger Bands settings for measuring channel width.

ATR len: ATR period for volatility.

HV days: Lookback window (days) for Historical Volatility calculation.

📐 Calculations

ATR % (atrPct): Normalized ATR relative to price.

Bollinger Band width % (bbPct): Market channel width as percentage of basis.

Historical Volatility (hvAnn): Annualized volatility, calculated from daily log returns.

Dynamic Step % (dynStepPct): Step size for safety orders, automatically adjusted from ATR and clamped between 0.3% and 5%.

Covered Move % (coveredPct): Total percentage move the bot can withstand before last safety order.

Martingale Size Factor (sizeFactor): Total position size multiplier after all safety orders, based on martingale multiplier.

Risk Score (riskLabel): Simple risk estimate:

Low if risk < 30

Mid if risk < 60

High if risk ≥ 60

📊 Output (Table on Chart)

At the top-right of the chart, the script draws a table with 9 rows:

Metric Value
BB % Bollinger Band width in %
HV % Historical Volatility (annualized %)
TP % Take profit setting
SO step % Safety order step size
SO n Number of safety orders
M mult Martingale multiplier
Dyn step % Dynamic step based on ATR
Size x Total position size factor (e.g., 4.5x)
Risk Risk label (Low / Mid / High)
⚙️ Use Case

Helps choose coins for a martingale bot:
If BB% is wide and HV% is high → the asset is volatile enough.
If Risk shows "High" → parameters are aggressive, you may need to adjust step size, SO count, or leverage.

The dashboard lets you compare assets quickly without switching between multiple indicators.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.