bushido-tradingview-mcp

v0.1.50
bushido-tradingview-mcp Checked 18 hours ago Published 1 day ago

MCP server that lets AI analyze the TradingView desktop app via Chrome DevTools Protocol

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_chart_screenshot

Capture a screenshot of the TradingView desktop app for visual analysis. By default the whole window (all charts, drawings, watchlist); pass chart_index to capture just one chart of a multi-chart layout at full resolution.

ParameterTypeDescription
chart_indexintegerCapture only this chart (index from get_chart_context). Default: whole window
formatstringImage format. jpeg is smaller; png is sharper. Default: jpeg

get_chart_context

Get the current TradingView layout state: every chart's symbol, timeframe and active indicators as {id, name} (the id is what get_indicator_* tools accept as study_id), plus which chart is active. Call this first to know what the user is looking at.

get_replay_status

Read the current TradingView Bar Replay state, active chart binding, historical cursor time, and replay resolution. This is read-only and never starts, advances, or stops replay trading.

start_chart_replay

Preview or start TradingView Bar Replay on the active chart at one historical instant. expected_symbol and expected_timeframe are checked immediately before the write. confirm=true is required. Replay Trading orders and autoplay are never used.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
start_at *string
chart_indexinteger
confirmbooleanMust be true to enter Bar Replay. Default: false

step_chart_replay

Advance an already started, paused TradingView Bar Replay by 1-100 bars. Each step is read back and must advance the replay cursor. Autoplay and Replay Trading orders are not supported.

ParameterTypeDescription
stepsintegerBars to advance. Default: 1

stop_chart_replay

Preview or stop TradingView Bar Replay and return the chart to real-time mode. confirm=true is required when replay or its toolbar is active.

ParameterTypeDescription
confirmbooleanMust be true to leave Bar Replay. Default: false

get_ohlcv

Get OHLCV candle data (time, open, high, low, close, volume) currently loaded in a TradingView chart. Time is a unix timestamp in seconds.

ParameterTypeDescription
chart_indexintegerChart index in a multi-chart layout. Default: the active chart
countintegerNumber of most recent bars to return. Default: 100

run_event_study_falsification_audit

Calibrate one frozen FVG-retest, session-auction or event-aftershock event-study decision rule against deterministic, predictability-free synthetic OHLC. It runs each selected null model separately and returns the candidate rate over the evaluated replications, Wilson interval, seed range, failures, and the seeds left out as not evaluable (a study that is not complete, or too few events at the candidate branch and horizon or in a fold); with none evaluated the rate is null. A candidate requires a global mean confidence interval wholly above zero plus positive evidence in every synthetic fold.…

ParameterTypeDescription
study *
barsintegerSynthetic closed bars per replica. Default: 5000
first_seedinteger
modelsarraySeparate null-model runs. Default: all three; model rates are never pooled
nominal_alphanumberReference candidate rate. Default: 0.05
replicationsintegerPer-model independent replicas. Default: 400
volatilitynumber

run_market_event_study

Run a bounded, read-only market event study on closed OHLC bars from the active chart. Condition session_auction classifies the first break of a prior local-session range as accepted outside closes or a failed return inside. Condition session_exhaustion_handoff tests whether a closed-bar prior-session direction fails to extend in an early handoff session and reverses; its outcomes begin only after the configured handoff window has fully closed. Condition event_aftershock_retest evaluates caller-supplied, canonical economic-event timestamps through a post-event initial range, close breakout, an…

get_dxy_context_gate_template

Return the fixed Pine Study template that reads confirmed DXY daily data with lookahead_off and exposes dxy_return_20 and dxy_gate plots. Read-only.

run_yield_price_nonconfirmation_study

Run a bounded, read-only cross-asset event study over two exact TradingView charts, with an optional third-chart OHLC regime or fixed DXY Pine gate on the target chart. A driver impulse becomes usable only after its nominal bar close; the study then tests whether the target fails to break in the expected direction and confirms an opposite structural close. It uses an as-of join without forward-fill and returns forward return, MFE, MAE, target timing, fold results, and explicit exclusions. Signal-bar close is an event reference, not an assumed fill. It never changes charts, ranks parameters, or…

ParameterTypeDescription
driver_change_threshold *number
driver_chart_index *integer
driver_lookback *integer
expected_driver_symbol *string
expected_driver_timeframe *string
expected_target_symbol *string
expected_target_timeframe *string
horizons *arrayObserved-bar return horizons. Only horizon 1 can be statistically candidate-eligible.
max_driver_age_bars *integer
minimum_events *integer
nonconfirmation_bars *integer
price_breakout_lookback *integer
relationship *string
target_chart_index *integer
target_return_bps *number
trigger_lookback *integer
trigger_within_bars *integer
configuration_trialsintegerNumber of evaluated lead/lag and parameter trials for multiple testing reference (default: 1)
context_indicatorobject
context_regimeobject
countintegerMost recent loaded bars to inspect on each chart. Default: 5000
driver_lag_barsintegerLag offset in target bars after driver impulse close (default: 0)
event_limitintegerMaximum per-event rows to return. Aggregate metrics always use all events. Default: 50
foldsarray
signal_fromstringInclusive signal-bar timestamp for a fixed forward collection window

run_feature_outcome_falsification_audit

Calibrate the frozen feature-outcome candidate gate against deterministic synthetic null OHLC. A candidate must pass the horizon-one, non-overlapping Newey-West, Bonferroni, and fixed 1,000-replication empirical-null rule. It does not read or change TradingView, record a journal entry, rank variants, or establish profitability.

ParameterTypeDescription
configuration_trials *integer
features *array
horizons *array
minimum_effect_bps *number
minimum_observations *integer
timeframe *string
atr_baseline_lookbackinteger
atr_compression_high_rationumber
atr_compression_low_rationumber
atr_lookbackinteger
barsinteger
body_ratio_thresholdnumber
confidence_level
first_seedinteger
gap_atr_thresholdnumber
modelsarray
nominal_alphanumber
range_lookbackinteger
range_position_lowernumber
range_position_uppernumber
replicationsinteger
streak_minimum_barsinteger
volatilitynumber
wick_imbalance_thresholdnumber

run_lead_lag_falsification_audit

Calibrate the frozen lead-lag candidate rule against paired nulls. Factor variants carry contemporaneous dependence but no lagged predictability; independent variants isolate marginal path effects. Every replication runs the rule's own circular-shift empirical null after the default contract's fixed causal prior-20-return RMS scaling (runner v7; a draw too sparse to judge is left out of the rate). The result carries its fully resolved configuration and a hash of it, so a quoted rate can be reproduced. It does not read or change TradingView and does not establish profitability.

ParameterTypeDescription
configuration_trials *integer
folds *array
max_lag_bars *integer
minimum_observations *integer
timeframe *string
barsinteger
confidence_level
first_seedinteger
modelstring
nominal_alphanumber
replicationsinteger
return_standardizationstringDefault causal_prior_20_rms is the v7 runner (the v3 contract, with draws too sparse to evaluate left out of the rate). none is the invalidated legacy contract (v6, formerly v2) for reproduction only.
rhonumber

run_feature_outcome_power_audit

Measure how often the frozen feature-outcome candidate gate detects a predeclared signed next-bar effect injected after one body-direction bucket. It is synthetic sensitivity evidence, not market alpha.

ParameterTypeDescription
configuration_trials *integer
effect_bps *array
features *array
horizons *array
minimum_effect_bps *number
minimum_observations *integer
target_bucket *string
timeframe *string
atr_baseline_lookbackinteger
atr_compression_high_rationumber
atr_compression_low_rationumber
atr_lookbackinteger
barsinteger
body_ratio_thresholdnumber
confidence_level
first_seedinteger
gap_atr_thresholdnumber
modelsarray
nominal_alphanumber
range_lookbackinteger
range_position_lowernumber
range_position_uppernumber
replicationsinteger
streak_minimum_barsinteger
volatilitynumber
wick_imbalance_thresholdnumber

compute_feature_outcome_relationships

Measure point-in-time relationships between selected closed-bar price features and later observed returns on one exact TradingView chart. It classifies ATR compression, candle body direction, wick imbalance, directional streaks, range position, and opening gaps using only the signal bar and prior OHLC. It returns bucketed forward-return, upside, downside, and fold distributions without optimizing thresholds, changing the chart, or making a trade recommendation.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
horizons *array
minimum_effect_bps *numberFrozen pre-registered candidacy floor in basis points. It must be stated and cannot be relaxed; significance alone reports existence, not size.
atr_baseline_lookbackinteger
atr_compression_high_rationumber
atr_compression_low_rationumber
atr_lookbackinteger
body_ratio_thresholdnumber
confidence_levelConfidence level for normal-approximation mean and Wilson rate intervals. Default: 0.95
configuration_trialsintegerTotal related feature/threshold configurations inspected so far, including this one
countintegerMost recent loaded bars to inspect. Default: 5000
empirical_null_calibrationbooleanRun the fixed 1,000-replication circular moving-block empirical-null calibration on the same closed bars. Default: false
feature_selectionobjectOne preregistered feature bucket. Cannot be combined with features.
featuresarrayPoint-in-time features to classify. Default: all six
foldsarray
gap_atr_thresholdnumber
journalobject
minimum_observationsinteger
observation_limitintegerMaximum labelled observations to return. Aggregates always use all rows. Default: 100
range_lookbackinteger
range_position_lowernumber
range_position_uppernumber
regimeobjectOptional predeclared point-in-time market-regime filter for a limited feature hypothesis
signal_fromstringInclusive signal-bar timestamp for a fixed forward collection window
signal_tostringExclusive signal-bar timestamp for a fixed forward collection window
streak_minimum_barsinteger
wick_imbalance_thresholdnumber

compute_session_profile

Summarize deterministic session-day profiles from closed minute bars on one exact TradingView chart. Sessions use caller-specified IANA timezones and support daylight-saving and cross-midnight boundaries. The tool returns coverage, OHLC range, return, opening-range extension, high/low timing, VWAP, prior closed-session overlap and high/low reaction tests (PDH/PDL/PDC), and TradingView bar volume clearly labelled as unverified tick-or-exchange volume. It does not change the chart, optimize session definitions, or make a trade recommendation.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *stringExact active minute timeframe, such as 5, 15, or 60
sessions *array
countintegerMost recent loaded bars to inspect. Default: 5000
minimum_session_daysintegerMinimum complete days required for each session. Default: 20
observation_limitintegerMaximum recent session observations returned. Aggregates use all rows. Default: 100
opening_range_barsintegerBars from session start used for the opening range. Default: 3

compute_market_regimes

Classify deterministic directional and volatility regimes from closed OHLC bars already loaded on the active chart. Every label uses only that bar and earlier evidence: efficiency ratio and ATR-normalized directional movement classify trend/range/transition, while current ATR relative to a trailing ATR median classifies low/normal/high volatility. Thresholds are explicit and no future-fitted quantiles, ranking, chart changes, or trade recommendations are used.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
atr_lookbackintegerBars used for point-in-time ATR. Default: 14
countintegerMost recent loaded bars to inspect. Default: 1000
directional_move_atr_thresholdnumberMinimum absolute lookback move in current ATR units for trend. Default: 2
high_volatility_rationumberCurrent ATR-percent / trailing median ratio for high volatility. Default: 1.5
low_volatility_rationumberCurrent ATR-percent / trailing median ratio for low volatility. Default: 0.75
minimum_classified_barsintegerClassified observations required for complete status. Default: 100
observation_limitintegerMaximum recent classified rows returned; aggregates use all rows. Default: 100
range_efficiency_thresholdnumberMaximum efficiency ratio for a range candidate. Default: 0.25
trend_efficiency_thresholdnumberMinimum efficiency ratio for a trend candidate. Default: 0.6
trend_lookbackintegerBars used for direction and efficiency ratio. Default: 20
volatility_baseline_lookbackintegerTrailing ATR-percent observations used for the baseline median. Default: 50

run_strategy_regime_analysis

Run one exact saved Pine Strategy temporarily, collect its complete immutable trade ledger, and join each closed trade to the latest market-regime bar whose nominal close was available by entry time. Returns PF, expectancy, win rate, closed-trade drawdown, run-up/drawdown, and coverage by directional, volatility, and combined regime. Dry-run by default; confirm=true is required. The strategy is removed and the original chart fingerprint is verified. It never ranks regimes, changes the saved Pine source, or places orders.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
pine_id *string
pine_version *string
atr_lookbackinteger
confirmbooleanMust be true to add the strategy temporarily and run the analysis. Default: false
correlation_regimeobjectOptional rolling correlation groups from a second bound chart with the same timeframe
countintegerMost recent loaded bars used for regime evidence. Default: 20000
directional_move_atr_thresholdnumber
event_proximityobjectOptional scheduled-event entry-time groups; caller supplies canonical UTC timestamps
high_volatility_rationumber
inputsarray
low_volatility_rationumber
max_regime_age_barsintegerMaximum age of the prior closed regime evidence. Default: 3 bars
minimum_classified_barsintegerRegime observations required before evaluation is complete. Default: 100
minimum_coverage_rationumberEligible closed trades that must join to a regime. Default: 0.8
minimum_group_tradesintegerJoined trades required for an individual regime group. Default: 30
range_efficiency_thresholdnumber
session_match_policystringSession overlap handling. Default: all_matches_non_exclusive; exclusive uses input order
sessionsarrayOptional DST-aware session windows used for entry-time grouping
trend_efficiency_thresholdnumber
trend_lookbackinteger
volatility_baseline_lookbackinteger

run_strategy_regime_matrix

Run a bounded serial matrix of exact saved Pine Strategies across explicit symbols and timeframes, then join each complete trade ledger to point-in-time market regimes. Each job reads loaded closed OHLC, temporarily adds one strategy, removes it, and verifies restoration of the original chart. Returns coverage and descriptive performance by regime without ranking or automatic adoption. Dry-run by default; confirm=true is required. It never changes saved Pine source or places orders.

ParameterTypeDescription
expected_symbol *stringExact active-chart symbol before and after the matrix
expected_timeframe *stringExact active-chart timeframe before and after the matrix
jobs *array
atr_lookbackinteger
confirmboolean
correlation_regimeobjectOptional matrix-default rolling correlation groups from one reference chart
countinteger
directional_move_atr_thresholdnumber
event_proximityobjectOptional scheduled-event entry-time groups; caller supplies canonical UTC timestamps
high_volatility_rationumber
load_more_barsintegerHistory load per job before OHLC capture, split into 5000-bar requests. Default: 0
low_volatility_rationumber
max_regime_age_barsinteger
max_runtime_secondsintegerDo not start another job after this soft deadline. Default: 900
minimum_classified_barsinteger
minimum_coverage_rationumber
minimum_group_tradesinteger
range_efficiency_thresholdnumber
session_match_policystringSession overlap handling. Default: all_matches_non_exclusive; exclusive uses input order
sessionsarrayOptional DST-aware session windows used for entry-time grouping
trend_efficiency_thresholdnumber
trend_lookbackinteger
volatility_baseline_lookbackinteger

get_indicator_values

Get recent plot values of indicators (studies) on a TradingView chart — e.g. signal levels, bands, oscillator readings. Plot names come from the indicator's own style titles. Cosmetic plots (colors, alert flags) are excluded by default. Use get_chart_context first to see which indicators exist. Narrow to specific plots with plot_titles, which is required above 500 bars so a long history stays readable.

ParameterTypeDescription
chart_indexintegerChart index in a multi-chart layout. Default: the active chart
countintegerNumber of most recent bars to return per indicator. Above 500 requires plot_titles. Default: 10
include_all_plotsbooleanInclude cosmetic plots (colorers, alert conditions). Default: false
plot_titlesarrayOnly return these plots, matched case-insensitively on plot title or plot id
study_idstringIndicator id from get_chart_context. Default: all indicators

get_indicator_inputs

Get the input parameters (settings) of indicators on a TradingView chart, with names, current values, defaults and tooltips — e.g. 'Pivot Length: 5'.

ParameterTypeDescription
chart_indexintegerChart index in a multi-chart layout. Default: the active chart
study_idstringIndicator id from get_chart_context. Default: all indicators

set_indicator_input

Change input values of an indicator or strategy already on a chart — the write counterpart to get_indicator_inputs. The Pine source is untouched, but the study's input values on the chart remain changed until set back (this is a live chart edit, like opening the study's Settings dialog, and may be captured by TradingView's own layout autosave). Works for both plain indicators and strategies (for a strategy, follow up with get_strategy_report to read the recalculated backtest). Use this to A/B-test parameters without re-saving the script each time, and restore the original values when done.

ParameterTypeDescription
inputs *arrayInputs to change, e.g. [{id:'in_0', value:14}]. Get ids/current values from get_indicator_inputs
study_id *stringIndicator/strategy id from get_chart_context or add_pine_to_chart/run_backtest(keep_on_chart:true)
chart_indexintegerChart index in a multi-chart layout. Default: the active chart

get_indicator_graphics

Get drawing primitives (labels with text+price, trend lines, boxes/zones) that a Pine indicator has drawn on a TradingView chart. This is how to read drawing-only indicators (e.g. Elliott Wave labels, support/resistance lines, order blocks) that have no numeric plots. Most recent primitives first. Times beyond the last bar are extrapolated and flagged timeEstimated.

ParameterTypeDescription
chart_indexintegerChart index in a multi-chart layout. Default: the active chart
limit_per_kindintegerMax labels/lines/boxes each, most recent first. Default: 50
study_idstringIndicator id from get_chart_context. Default: all indicators

get_indicator_tables

Read tables drawn by Pine indicators on a TradingView chart (e.g. a multi-timeframe trend dashboard in the corner) as text grids: grid[row][column] plus the table's on-chart position. This is the only way to read table-only summaries that have no plots or drawings.

ParameterTypeDescription
chart_indexintegerChart index in a multi-chart layout. Default: the active chart
study_idstringIndicator id from get_chart_context. Default: all indicators

run_indicator_table_study

Preview or run a bounded serial table measurement using one exact own saved Pine indicator version on an explicit chart. Pages history until two consecutive empty observations (maximum 24 calls per symbol), waits for readiness, reads tables once, returns table SHA-256 and explicit marker-cell comparisons, removes only its added study, and verifies symbol/timeframe/study-list restoration. Dry-run by default; confirm=true is required. No Strategy Tester, orders, alerts, saved-source writes, or automatic adoption.

ParameterTypeDescription
chart_index *integer
expected_symbol *string
expected_timeframe *string
pine_id *string
pine_version *string
symbols *array
timeframe *string
confirmboolean
history_chunkinteger
max_history_attemptsinteger

load_more_history

Load more historical bars into a TradingView chart (like scrolling left), so that get_ohlcv and get_indicator_values can see further back. The visible chart view is not changed. By default makes one request. until_exhausted=true continues until two consecutive requests add no bars, bounded by max_attempts. Returns aggregate growth, each load and stopReason (consecutive_empty, attempt_limit, requested_count_reached); exhaustion is local to these attempts.

ParameterTypeDescription
chart_indexintegerChart index in a multi-chart layout. Default: the active chart
countintegerHow many additional bars to request. Default: 300
max_attemptsintegerDefault: 24 with until_exhausted, otherwise 1. With until_exhausted=false, repeat only until count bars have been added
until_exhaustedbooleanRepeat count-sized requests until two consecutive loads add no bars. Default: false

list_pine_scripts

List the user's own saved Pine scripts (indicators and strategies) with their pine_id, kind and version, cross-referenced with the charts: usedBy shows which on-chart indicators are rendered from each script. Use this to find the pine_id for get_pine_source. Read-only.

get_pine_source

Get the full Pine source code of one of the user's OWN saved scripts, for review or improvement suggestions. Only 'USER;...' ids from list_pine_scripts are accepted; published/protected third-party scripts are refused. Read-only — editing or saving scripts is not supported. With bounded_hash_ledger_id and bounded_hash_report_state_sha256 from a get_strategy_trade_ledger identity read, it returns only byte counts and SHA-256 hashes of that fixed version (no source text, 128 KiB response cap), once per identity read.

ParameterTypeDescription
pine_id *stringScript id from list_pine_scripts, e.g. 'USER;adc40b1dfee344f19412f1ae9af74f3f'
bounded_hash_ledger_idstringVerify only hashes of the fixed version associated with a prior identity-only ledger read; 128 KiB response cap
bounded_hash_report_state_sha256stringThe report-state hash returned by the same identity-only ledger read
versionstringVersion to fetch, e.g. '3'. Default: 'last'. Older versions are how you revert a bad save

get_analysis_overlay_template

Get the audited generic Pine overlay used to render a structured market analysis (entry zone, confirmation, invalidation, stop, targets, confidence and expiry). Read-only: pass the returned source to save_pine_script, then add_pine_to_chart once; subsequent analyses should update that study with apply_analysis_overlay.

get_volume_profile_context_template

Get the audited Pine template that exposes only a completed exchange-trading-day chart-bar volume-allocation profile's prior POC, VAH and VAL as readable plots. It does not claim Bid/Ask order flow or institutional activity. Save it with save_pine_script, add it once with add_pine_to_chart, then use get_volume_profile_context.

get_volume_profile_context

Read a completed prior-session POC, VAH and VAL only from the exact audited Bushido Volume Profile Context Pine template. The saved source, study placement, symbol and timeframe are verified fail-closed. Results describe a volume-derived price-level context, not direct large-order, Bid/Ask, or order-flow evidence.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
pine_id *stringSaved audited template id
study_id *stringOn-chart instance id
chart_indexinteger

get_price_action_context_template

Get the audited Pine template that marks pin bars, engulfing bars and 20-bar sweeps, and exposes each as a readable plot. Marks and alerts are gated on bar close, so nothing appears intrabar and then disappears. Save it with save_pine_script, add it once with add_pine_to_chart, then use get_price_action_context.

get_price_action_context

Read the latest bar's pin-bar, engulfing and sweep readings only from the exact audited Bushido Price Action Context Pine template. The saved source, study placement, symbol and timeframe are verified fail-closed, and so are the study inputs: a study with Confirm On Bar Close switched off is refused, because its signals can change after being read. Any other departure from the audited defaults is reported in settings and flagged in qualityIssues. A signal of 0 on an unconfirmed bar means the bar has not closed yet, not that the pattern is absent.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
pine_id *stringSaved audited template id
study_id *stringOn-chart instance id
chart_indexinteger

run_price_action_pattern_study

Measure what the three price-action patterns are worth as naked entries on the chart's own bars: enter at the signal bar's close in the direction the pattern reads, exit h bars later, with no stop, target or filter. Uses the same rules as the Pine template at its default settings. Reports each pattern's forward return with an IID normal-approximation interval for description only alongside the clock hours it fires in and what any bar in those hours does anyway, because a pattern that only fires at a session boundary will otherwise report that boundary as an effect.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
chart_indexinteger
countintegerBars to read. More bars is a longer sample, never a different rule.

run_volume_profile_reaction_study

Run one frozen descriptive #61b reaction-study variant on CME exchange-volume chart bars and the exact audited Bushido Volume Profile Context proxy. The 240-minute v1 and 60-minute v1 variants are separate methodologies and their evidence must not be combined. Both fix 24 rows, 70% value area, four rejection/acceptance branches, horizons 1/2/4/8 and a 20 bps descriptive target. It also compares each branch with non-event bars in the same prior-closed directional-plus-volatility regime, standardized to the event regime mix. It verifies source, placement, inputs, symbol and timeframe and never r…

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
pine_id *string
study_id *string
chart_indexinteger
countintegerMost recent closed chart/profile rows. Default: 5000; the 60-minute variant supports up to 15,000 after explicit history loading
event_limitinteger
foldsarray
signal_fromstring
signal_tostring

run_volume_profile_poc_reversion_study

Run the separately frozen descriptive #61b 60-minute POC-reversion study on CME exchange-volume chart bars and the exact audited Bushido Volume Profile Context proxy. A signal is the first completed close outside VAH or VAL and at least 20 bps from the completed prior POC; it measures return toward that POC, POC-touch frequency, and a same-prior-regime non-event baseline. This is not the VAH/VAL reaction study and its evidence must not be combined with that population. It is descriptive only and never ranks or adopts a branch.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
pine_id *string
study_id *string
chart_indexinteger
countintegerMost recent closed chart/profile rows. Default: 5000; up to 15000 after explicit history loading
event_limitinteger
foldsarray
signal_fromstring
signal_tostring

save_pine_script

Save Pine source to the user's script library — the ONLY write tool, with a confirm flow: without confirm=true nothing is written and a dry-run preview is returned; show it to the user and get their approval before calling again with confirm=true. Non-destructive by design: creates a new script (name, no pine_id) or a new version of an existing one (pine_id), and every older version stays retrievable via get_pine_source(pine_id, version). Compile errors are returned with line numbers; note the version is stored even if compilation fails (see revertHint). Typical PDCA loop: get_pine_source ->…

ParameterTypeDescription
source *stringFull Pine source, e.g. starting with //@version=5
confirmbooleanMust be true to actually write. Default: false = dry run only
namestringScript name — required when creating a new script, optional rename otherwise
pine_idstringExisting script to save a NEW VERSION of. Omit to create a new script

add_pine_to_chart

Add one of the user's OWN saved Pine scripts (latest version) to a TradingView chart as a study — e.g. to show an improved indicator after save_pine_script. Additive only: never removes or replaces existing studies (the user can remove it from the chart UI). For strategies prefer run_backtest, which cleans up after itself.

ParameterTypeDescription
pine_id *stringScript id from list_pine_scripts
chart_indexintegerChart index in a multi-chart layout. Default: the active chart

remove_owned_study

Preview or remove one on-chart instance of the user's OWN saved Pine script. The tool verifies the USER pine_id against both list_pine_scripts and the study's hidden Pine id before removal. It also fails closed if the chart symbol or timeframe changed. Without confirm=true nothing is removed.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
pine_id *string
study_id *string
chart_indexinteger
confirmboolean

ensure_analysis_overlay

Idempotently ensure that the audited Bushido Analysis Overlay is present once on a target chart at the latest saved Pine version. It reuses a current instance, adds a missing one, or transactionally adds the latest version, migrates the analysis inputs, verifies them, then removes the old instance. Source, symbol, timeframe, pine_id, version and input contract are checked fail-closed. Without confirm=true, any chart-changing action is preview-only.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
pine_id *stringSaved Bushido Analysis Overlay id from list_pine_scripts
chart_indexinteger
confirmboolean

get_analysis_overlay_status

Read the current Bushido Analysis Overlay state without changing the chart. It resolves the study by USER pine_id, verifies the exact on-chart Pine version source and context-bound input contract, then returns analysis metadata, expiry, current-price relations, risk/reward references and drawing integrity. Level states describe only the current price, not historical touch order; use a future outcome tool for that.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
pine_id *stringSaved Bushido Analysis Overlay id from list_pine_scripts
chart_indexinteger

evaluate_analysis_overlay_outcome

Evaluate the first confirmed Target-versus-Stop outcome of an audited Bushido Analysis Overlay using only loaded, closed OHLCV bars after the analysis time. The analysis-containing bar and forming bars are excluded. Entry must precede an optional confirmation; invalidation reached before confirmation cancels the setup. Same-bar ordering, gaps and incomplete history are reported as ambiguous or incomplete rather than guessed. Calendar-month charts are not evaluable because their duration varies. By default it is read-only. When evaluation_timeframe is specified, it temporarily changes only the…

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
pine_id *stringSaved Bushido Analysis Overlay id from list_pine_scripts
chart_indexinteger
countintegerMost recent loaded bars to inspect. Default: 1000
evaluation_timeframestringOptional evidence timeframe, e.g. 15 or 1H. The overlay remains verified against expected_timeframe and the chart is restored afterward
recordbooleanExplicitly append this evaluation to the local analysis journal. Default: false

evaluate_due_analyses

Preview or evaluate due analyses directly from the local analysis journal. Without confirm=true it only lists candidates and estimated chart changes. With confirmation it temporarily changes one selected chart's symbol and evidence timeframe for each analysis, evaluates closed OHLCV, records the result, and restores the original chart after every item. Individual failures do not stop the batch; a chart restoration failure stops all remaining work. An evaluation that finds the result already recorded, or fails, is noted in an attempt log beside the journal, so analyses that do not resolve take…

ParameterTypeDescription
chart_indexinteger
confirmbooleanMust be true to change the chart and append outcomes. Default: false
countintegerLoaded OHLCV bars inspected per analysis. More bars than a history_incomplete record requested recheck it. Default: 1000
evaluation_timeframestringOptional evidence timeframe for every candidate; defaults to each analysis timeframe
include_activebooleanInclude active analyses with no prior evaluation. Default: false
include_fixedbooleanAlso recheck results skipped as fixed for the request: ambiguous or gapped results whose history reached the expiry on the same timeframe, and history_incomplete results on the same timeframe without…
limitintegerMaximum analyses to evaluate. Default: 20
load_more_barsintegerExplicit history load before evaluation. A larger load than a history_incomplete record's rechecks it. Default: 0 (no persistent history load)

apply_analysis_overlay

Preview or apply a structured market analysis to an existing Bushido Analysis Overlay study. The tool fails closed when the chart symbol, timeframe or overlay input contract does not match. Without confirm=true it is read-only and returns a preview. With confirm=true it changes only that overlay's inputs, then reads them and its drawing totals back for verification. It never places orders or alerts.

ParameterTypeDescription
analysis_id *string
analyzed_at *string
bias *string
confidence *number
entry_high *number
entry_low *number
expected_symbol *stringExact symbol expected on the target chart, e.g. OANDA:USDJPY
expected_timeframe *stringExpected chart resolution, e.g. 15, 240, 4H or 1D
invalidation *number
stop *number
study_id *stringOverlay study id returned by add_pine_to_chart or get_chart_context
targets *array
chart_indexinteger
confirmbooleanMust be true to edit the live chart. Default: false = dry run
confirmationnumber
expires_atstring
notestring
snapshot_idstringOptional get_market_snapshot snapshot_id binding this analysis to its evidence
strategy_versionstringOptional strategy or decision-policy version used for this analysis

get_analysis_journal

Read locally journaled analysis definitions and their monotonic latest evaluations, with the evaluation recorded last beside them when it is not the latest (recentOutcome). A completed evaluation is never displaced by a later stale ongoing read. This tool does not access or change the TradingView chart.

ParameterTypeDescription
analysis_idstring
limitinteger
symbolstring

get_analysis_performance

Aggregate live analysis-journal outcomes into explicit populations for binary win rate, gross/net R, MFE/MAE and timing. Missing historical path metrics, non-binary outcomes and absent cost assumptions are excluded with counts rather than filled with zero. This read-only tool never mixes Strategy Tester backtests into the live-analysis population.

ParameterTypeDescription
biasstring
cost_assumptionsarrayOptional symbol-specific round-trip costs in instrument price units per unit
group_bystring
strategy_versionstring
symbolstring
timeframestring

get_analysis_calibration

Calculate confidence calibration from the local analysis journal. Only target_before_stop is labelled positive and stop_before_target negative; ambiguous, incomplete, cancelled, neutral, and unevaluated analyses are reported as exclusions.

ParameterTypeDescription
biasstring
binsinteger
symbolstring

get_strategy_report

Read the backtest report (Strategy Tester) of the strategy currently on the active TradingView chart: net profit, win rate, profit factor, drawdown, Sharpe/Sortino, and the most recent trades with entry/exit details. A live position is the last trade with status 'open' and no exit. Percent-style fields are fractions (0.33 = 33%). Fails if no strategy is on the chart — use run_backtest to test a saved strategy without leaving it on the chart.

ParameterTypeDescription
chart_indexintegerRequire this chart index to be active
expected_study_idstringRequire the active Strategy Tester report to belong to this study
require_replay_alignmentbooleanRequires chart_index and expected_study_id. Returns results only when paused Replay selection, cursor and report end agree
trades_limitintegerMax most-recent trades to include. Default: 20

record_research_period_usage

Record a user-reported research data access in a local append-only journal. Requires confirm:true. Use a stable series_id across revisions and research projects; data_version is a content hash. Records the full inspected UTC interval [from,to), purpose and actual accessed_at. Retries with the same access_id are idempotent; conflicts fail. No chart access, orders or file paths. Reporting use is not preregistration or proof of an unused OOS period. summary_only:true replaces the listed overlapping records with counts and distinct research IDs.

ParameterTypeDescription
access_id *string
accessed_at *string
confirm *boolean
data_version *string
from *string
purpose *string
research_id *string
series_id *string
to *string
summary_onlybooleanReturn counts and distinct research IDs instead of every overlapping record.

record_research_period_usage_batch

Record 1-20 user-reported research data accesses in one call, same fields and rules as record_research_period_usage. Requires confirm:true and unique access_ids. Every record is validated, conflict-checked and capacity-checked before any write, so a rejected batch writes nothing. If an I/O failure stops the append after complete lines, an identical retry completes it; a torn partial line fails closed until the file is repaired. Records are appended in order, so a later record's prior_overlap includes earlier ones. summary_only:true replaces listed overlapping records with counts and distinct r…

ParameterTypeDescription
confirm *boolean
records *array
summary_onlybooleanReturn counts and distinct research IDs instead of every overlapping record.

preflight_research_oos

Read-only pre-execution OOS usage check for an evaluation interval [from,to). Any recorded exploration or validation across research IDs and versions of the exact series blocks it. No overlap, including declared-unused input, requires external review and never authorizes execution. This is a snapshot, not a reservation or execution token; existing backtest tools are not intercepted. No data/chart access or journal append. Forward period declarations (declare_forward_period) overlapping the interval block it unless research_id is the declaring study's and the interval is exactly its ended decla…

ParameterTypeDescription
data_version *string
from *string
series_id *string
to *string
prior_usage_declarationstring
research_idstring
summary_onlybooleanReturn counts and distinct research IDs instead of every overlapping record.

declare_forward_period

Record, with confirm:true, that one research_id intends to use a future period [from,to) on 1-20 exact series only for the one evaluation whose frozen protocol protocol_sha256 names. The server clock must be at least 24 h before from; the period lasts 24 h to 366 days and may not overlap another active declaration on the same series. Optional hypothesis {kind: strategy|event, id} must be registered in the research journal. This is evidence of intent recorded by the local clock, never proof of unused data, a reservation or an approval: no access is refused, and check_research_period_usage and p…

ParameterTypeDescription
confirm *boolean
declaration_id *string
from *string
protocol_sha256 *string
research_id *string
series_ids *array
to *string
hypothesisobject

shorten_forward_period

With confirm:true, stop declaring the part of a forward period declaration from new_end on. new_end must be at least 24 h after now, below the current end, and either the declared from (a full withdrawal) or at least 24 h after it. research_id must match the declaration. A shortening recorded within 24 h of the start or after it marks the declaration shortened_after_start, and preflight_research_oos then never reaches its review answer for it. The part no longer declared may be declared by other studies. Identical retries are idempotent. No chart access, orders or file paths.

ParameterTypeDescription
confirm *boolean
declaration_id *string
new_end *string
reason *string
research_id *string

compare_research_evidence

Compare caller-supplied SHA-256 manifests for previous/current research data, code, runner, candidate rule, parameters and environment. Reports changed and unknown axes plus required revalidation checks. Missing values never match. Does not read files, authenticate hashes, execute code, persist records or certify compatibility, calibration, unused OOS or candidate eligibility.

ParameterTypeDescription
current *object
previous *object

check_research_period_usage

Check recorded research data usage for a UTC interval [from,to). Finds overlapping use of the same stable series_id across ALL research IDs and data versions. No recorded overlap means unknown outside this journal, never unused or approved OOS. A declared-unused assertion is user supplied and cannot prove unused status. Does not record an access or reserve a period. Also lists forward period declarations (declare_forward_period) on the interval and the accesses overlapping them; fails closed when the declarations journal cannot be read. Unknown fields, including research_id, are rejected; pass…

ParameterTypeDescription
data_version *string
from *string
series_id *string
to *string
prior_usage_declarationstring
summary_onlybooleanReturn counts and distinct research IDs instead of every overlapping record.

record_research_series_relations

Append caller-declared version-specific series definitions, aliases, declared parent support windows, related pairs or revocations to a separate local registry. Requires explicit confirmation. No market data, chart operation or computation. Evidence hashes are integrity references, not authenticated provenance. See docs/RESEARCH_SERIES_RELATIONS.md.

ParameterTypeDescription
confirm *boolean
records *array

check_research_series_history

Explicit diagnostic over usage or trial history: exact IDs, version-bound aliases or shared declared source support. Captures target then registry under their locks; supports pinned prefix snapshots. Does not change old records/retries/reuses or resolve forward declarations; never grants execution or unused-data proof. Local locks may create directories and temporary lock files.

ParameterTypeDescription
from *string
mode *string
series *array
target *string
to *string
rules_versionstring
snapshotsobject

record_research_trials

Record 1-20 trial sets in a local append-only journal: how many configurations one study evaluated, discarded ones included, on which stable series_ids, data_version and UTC interval [from,to). Requires confirm:true. count_basis is enumerated, inferred or lower_bound; outcome_seen is pnl, forecast_only or none. reuses names the earlier trial sets (on a shared series, tried no later) where the configurations evaluated again were first evaluated, so checks count them once; record trial sets in the order tried. Stores counts, never metrics, returns or file paths; note is free text the tool cannot…

ParameterTypeDescription
confirm *boolean
records *array

check_research_trials

Count the recorded trial sets that share a series_id with the query and overlap the UTC interval [from,to), across all research IDs and data versions. Returns the configurations reported; the net count, each match's first-evaluated configurations plus the largest reuse of each trial set outside the matches; and the split by count_basis, outcome_seen and research ID. Every total is a lower bound: unrecorded studies are missing, counts are caller reported, and configurations are not independent trials. Read-only; never reads data. summary_only:true omits the matching records.

ParameterTypeDescription
from *string
series_ids *array
to *string
summary_onlybooleanReturn the counts and research IDs without the matching records.

summarize_backtest_ledger

Summarize a locally registered immutable backtest ledger by SHA-256 artifact ID. Filter exact symbols, direction, and exit timestamps (UTC, from inclusive/to exclusive); group by symbol/year/month. Requires explicit flat round-trip cost in bps. Recomputes PF from trade-level net wins/losses, never averages PFs. Reports sample break-even flat round-trip cost and signed cost headroom for each population; not an execution guarantee or confidence bound. Returns the entire-ledger baseline, selected subset and excluded complement at the same cost, with complete-case common-opportunity deltas. All fi…

ParameterTypeDescription
artifact_id *string
round_trip_cost_bps *number
directionstring
exclude_symbolsarray
fromstring
group_bystring
include_symbolsarray
research_idstring
tostring
usage_access_idstring

compare_forecast_losses

Compare two variance or covariance forecasts, A and B, on one horizon-1 forecast evaluation set under QLIKE or MSE (d = loss(A) - loss(B), lower is better). Returns the Diebold-Mariano test with Newey-West HAC and a fixed robustness battery: four fixed sub-periods, the trim of the 1% of days most favourable to the favoured side with its own missing days imputed worst case, the breakdown count k*, a secondary proxy and a centred stationary bootstrap. battery_outcome no_listed_conflict means only that the listed sign checks did not flip; it is never evidence of superiority. Pass exactly one of a…

ParameterTypeDescription
loss *string
artifact_idstring
inline_setobject
research_idstring
usage_access_idstring

compute_realized_covariance

Compute a daily realized covariance proxy from 1-8 imported bar series (tradingview-mcp-import-bar-series) under caller-chosen rules: bar interval, IANA time zone, local day end, weekdays, a missing-slot limit, the first interval (from the previous day's endpoint or within the day) and log or log-percent returns. Each produced day gets the realized covariance and the daily return outer product, or a drop cause; missing bars widen intervals and are never filled. The per-day values are stored as a proxy set (export with tradingview-mcp-export-proxy-set); the response returns only its proxy_set_i…

ParameterTypeDescription
from_date *string
rules *object
series *array
to_date *string
research_idstring
usage_access_idstring

backtest_risk_forecast

Backtest the VaR and volatility-targeting behaviour of forecasts A and B in a forecast set joined to a realized-covariance proxy set (source proxy-set:<hex>, from tradingview-mcp-import-forecast-set --proxy-set), for one portfolio weight vector. The signed daily returns are re-derived from the proxy set's own bar series and used only if the recomputation equals the stored proxy set; nothing the caller supplies enters them. VaR at fixed 1% and 5% levels from the forecast variance under a normal quantile with zero mean: Kupiec, Christoffersen independence and conditional coverage tests with Mont…

ParameterTypeDescription
artifact_id *string
target_annual_vol *object
weights *array
research_idstring
usage_access_idstring

get_strategy_trade_ledger

Read a stable, paginated ledger of every trade available in the active Strategy Tester report. Returns entry/exit, direction, profit, quantity, duration, and run-up/drawdown/commission when TradingView exposes them. Start with offset 0; pass the returned ledgerId as expected_ledger_id on later pages to fail closed if the strategy recalculates. Read-only and requires an active strategy. To bind a fixed Pine version without paging: capture_report_state=true returns ledgerId, studyId and reportStateSha256 (8 KiB cap); a later call with identity_study_id, expected_ledger_id and expected_report_sta…

ParameterTypeDescription
capture_report_statebooleanReturn only the pine_report_state_v1 capture of the active strategy: ledgerId, studyId, fixed Pine id and version, reportStateSha256 and the hashed state (8 KiB cap). Optional expected_ledger_id; no p…
chart_indexintegerRequire this chart index to be active
expected_ledger_idstringledgerId from page 1; rejects mixed pages after recalculation
expected_report_state_sha256stringPreviously captured pine_report_state_v1 SHA-256 for this ledger and study
expected_study_idstring
identity_study_idstringReturn only the bounded Pine identity of this exact active study; requires both captured hashes
limitintegerTrades to return in this page. Default: 200, maximum: 500
offsetintegerZero-based trade offset. Default: 0
require_replay_alignmentbooleanRequires chart_index and expected_study_id. Returns results only when paused Replay selection, cursor and report end agree

diagnose_replay_strategy_bar

Read-only diagnosis for a bound paused Replay and a standard 5-minute candlestick chart. Compares the selected time, cursor and native report-end bar using verified session boundaries. Returns evidence only and never authorizes adoption or returns performance or trades.

ParameterTypeDescription
chart_index *integer
expected_study_id *string

check_replay_adoption_candidate

Read-only check of a paused 5-minute Replay strategy report against a caller-bound target, using evidence from a verified Replay publisher only. No publisher is configured for the CDP adapter, so it returns held (publisher_unavailable) without reading the chart. It never returns performance, trades or adoption authority.

ParameterTypeDescription
chart_index *integer
expected_pine_id *string
expected_pine_version *string
expected_study_id *string
expected_symbol *string

diagnose_strategy_trade_overlap

Compare two supplied complete Strategy Tester ledgers for the same Pine version and inputs. Reports the first observed trade difference and boundary state supported by those ledgers. Does not read or change charts or produce a combined backtest.

ParameterTypeDescription
boundary *string
earlier *object
from *string
later *object
to *string

run_strategy_experiment

Run one bounded baseline-versus-candidate Strategy Tester experiment on the active chart. Both variants are resolved to exact saved Pine versions, applied serially with optional input overrides, bound to full-ledger SHA-256 ids, and removed after collection. Returns metric deltas without a synthetic score. Without confirm=true it only previews the experiment. It never places orders.

ParameterTypeDescription
baseline *object
candidate *object
expected_symbol *stringExact active-chart symbol, e.g. OANDA:USDJPY
expected_timeframe *stringExact active-chart timeframe, e.g. 240 or 1D
allowed_input_differencesarray
chart_indexintegerRequire this chart index to be active
confirmbooleanMust be true to temporarily add strategies and run the experiment. Default: false
expected_experiment_idstringRequired on confirmation of a fixed-period preview
fixed_periodobjectExact UTC report bar timestamps, including the last bar timestamp
minimum_tradesintegerClosed trades required per variant. Default: 30

run_backtest_matrix

Run a bounded, serial matrix of saved Pine strategies across explicit symbol, timeframe, and input combinations. The matrix is limited to 24 jobs and a soft runtime budget. Each strategy is temporarily added, bound to a full-ledger SHA-256 id, removed, and the original chart state is restored after every job. Failures and insufficient samples remain as rows; results are never ranked. Without confirm=true this only returns the resolved execution plan. It never places orders.

ParameterTypeDescription
expected_symbol *stringExact active-chart symbol before and after the matrix
expected_timeframe *stringExact active-chart timeframe before and after the matrix
jobs *array
confirmbooleanMust be true to change the chart and run the matrix. Default: false
max_runtime_secondsintegerDo not start another job after this soft deadline. Default: 600, maximum: 1800
minimum_tradesintegerClosed trades required per job. Default: 30

run_strategy_walk_forward

Run a bounded Pine Strategy walk-forward evaluation from full, immutable trade ledgers. Two to eight exact saved strategy/input candidates are collected serially on the bound chart, then partitioned into two to twelve explicit train, embargo, and test windows by closed-trade entry/exit time. Selection uses train metrics only; only the selected candidate's test metrics are exposed. Candidate failure, ledger quality issues, cost-condition differences, ties, and insufficient samples are not silently ignored. Without confirm=true this only previews the plan. Never places orders.

ParameterTypeDescription
candidates *array
expected_symbol *string
expected_timeframe *string
folds *array
mode *string
confirmboolean
embargo_barsintegerClosed bars between train and test. Default: 1
falsification_auditobjectOptional #45 ledger-level falsification audit. It replays the same candidate selection and OOS rule over centered, shared-calendar-block sign-flipped trade profits after full ledgers are collected. Ca…
max_runtime_secondsintegerDo not start another candidate after this soft deadline. Default: 600
minimum_test_tradesintegerTrades required for each selected OOS fold. Default: 10
minimum_train_tradesintegerTrades required to select a candidate in each train fold. Default: 30
selection_metricstringTrain-only metric to maximize. Default: expectancy

stress_test_strategy

Run bounded robustness tests for one exact saved Pine strategy. After a dry-run preview, confirm=true collects a baseline full ledger, applies modeled cost, commission, period-start, and seeded bootstrap scenarios, and can serially rerun up to eight explicit Pine input-override scenarios for Entry-delay, Stop/Target, or parameter-neighbor effects. Every temporary Strategy is removed and the chart fingerprint is checked before continuing. Results include failures, distributions, worst cases, and degradation without ranking, adoption, fabricated fills, or orders.

ParameterTypeDescription
evaluation_from *string
evaluation_to *string
expected_symbol *string
expected_timeframe *string
minimum_trades *integer
pine_id *string
pine_version *string
protocol_id *string
scenarios *array
bootstrap
confirmboolean
inputsarray
rerun_scenariosarray

register_measurement_hypothesis

Register an immutable measurement-only hypothesis (t_statistic) with its observation unit, test family and decision rule. Uses a separate local append-only measurement journal; no trading rules, chart access, computation or adoption. Same ID and definition is idempotent; a different definition requires a new ID. See docs/MEASUREMENT_RESEARCH.md for hash and storage contracts.

ParameterTypeDescription
evaluation_contract *object
hypothesis_id *string
thesis *string
title *string

get_measurement_hypothesis

Read one measurement hypothesis including its immutable definition hash; returns null for an unknown ID. No chart or network access. The local journal reader uses the existing file lock.

ParameterTypeDescription
hypothesis_id *string

register_strategy_hypothesis

Register one immutable strategy-research hypothesis and its evaluation contract in a local append-only journal. This does not access TradingView or run a test. Reusing a hypothesis_id with a different definition is rejected.

ParameterTypeDescription
evaluation_contract *object
hypothesis_id *string
thesis *string
title *string
parent_experiment_idstring

register_event_study_hypothesis

Register one immutable event-study or observational feature-study hypothesis and its outcome contract in the local append-only research journal. Use the optional journal field of run_market_event_study or compute_feature_outcome_relationships to record evidence without copying results by hand.

ParameterTypeDescription
audit_definition *objectExact standard falsification-audit CLI input. It is canonicalized and hash-bound in the immutable journal entry.
evaluation_contract *object
hypothesis_id *string
thesis *string
title *string

get_event_study_journal

List append-only market-event and observational feature-study evidence records, or compare exact selected records when both study_ids and evidence_hashes are supplied. It never accesses a chart.

ParameterTypeDescription
evidence_hashesarray
hypothesis_idstring
study_idsarray

record_strategy_experiment

Append one exact strategy experiment result to the research journal. The record binds the hypothesis, population, Pine versions, full-ledger ids, known metrics, guardrails, and decision. It stores no OHLC or source code and never touches a chart.

ParameterTypeDescription
baseline *object
candidate *object
conditions_matched *boolean
decision *string
experiment_id *string
hypothesis_id *string
methodology_version *string
minimum_trades_met *boolean
population *string
symbol *string
timeframe *string
notestring
parent_experiment_idstring

compare_strategy_experiments

Compare two to twenty exact saved experiment-evidence records without ranking or combining incompatible populations. References must include both experiment_id and evidence_hash. Read-only and does not access TradingView.

ParameterTypeDescription
references *array

run_backtest

Backtest one of the user's OWN saved strategies on the active chart's current symbol and timeframe: temporarily applies the strategy, waits for the Strategy Tester report, returns it (same shape as get_strategy_report) and removes the strategy again so the chart is left unchanged (set keep_on_chart to keep it). Get strategy pine_ids (kind 'strategy') from list_pine_scripts. Combine with set_symbol/set_timeframe to test other markets.

ParameterTypeDescription
pine_id *stringStrategy script id from list_pine_scripts, e.g. 'USER;71f1e4e6807c4bb48bd55edb886908a0'
chart_indexintegerRequire this chart index to be active
keep_on_chartbooleanLeave the strategy on the chart after the test. Default: false (auto-remove)
pine_versionstringExact numbered saved Pine version
trades_limitintegerMax most-recent trades to include. Default: 20

list_alerts

List the user's TradingView price alerts (read-only): symbol, condition, active state, last fire time. This tool does not create, modify, restart, or delete alerts.

create_analysis_alerts

Preview or create bounded, one-shot TradingView price alerts for Confirmation, Invalidation, and Target 1 from one audited Bushido Analysis Overlay. It verifies the exact Pine source, chart binding, analysis_id, current price, existing owned alerts, and post-create readback. Without confirm=true it is read-only. It never uses webhooks, email, SMS, broker APIs, or orders.

ParameterTypeDescription
analysis_id *string
expected_symbol *string
expected_timeframe *string
pine_id *string
chart_indexinteger
confirmbooleanMust be true to create alerts. Default: false
mobile_pushbooleanNotify in the TradingView app. Default: true
play_soundbooleanPlay TradingView's calling sound. Default: false
popupbooleanShow a TradingView popup. Default: true

get_watchlist

Get the user's TradingView watchlists: list names and their symbols, grouped by the user's section headers. Uses the app's logged-in session.

get_quotes

Get current quotes and technical data for specific symbols via TradingView's scanner API (no chart interaction). Default columns include close, change, volume, RSI and 'Recommend.All' — the overall technical rating in [-1, 1] (-1 strong sell, +1 strong buy). Other fields (e.g. 'MACD.macd', 'EMA50', 'price_earnings_ttm') can be requested via columns.

ParameterTypeDescription
symbols *arraySymbols in EXCHANGE:SYMBOL form, e.g. ['OANDA:EURUSD', 'NASDAQ:AAPL']
columnsarrayData fields to return. Default: description/close/change/volume/RSI/Recommend.All

get_market_snapshot

Build a read-only, point-in-time market data snapshot for environment analysis. It fetches quotes and a shared multi-timeframe overview for target and optional auxiliary symbols, with optional economic events. The result explicitly reports missing data, request-time timestamps, and quality status; it does not produce a trade instruction. TradingView scanner values do not expose a common source timestamp, so intraday timing must be treated as partial-quality evidence.

ParameterTypeDescription
symbols *arrayRequired analysis symbols in EXCHANGE:SYMBOL form, e.g. ['OANDA:EURUSD']
auxiliary_symbolsarrayOptional context symbols such as TVC:DXY or TVC:US10Y; total symbols may not exceed 20
countriesarrayEconomic-event countries when include_events is true
fieldsarrayShared overview fields without timeframe suffix. Default: common trend/momentum set
include_eventsbooleanInclude economic calendar data. Default: false
min_importancestringMinimum event importance when include_events is true. Default: medium
required_quote_fieldsarrayNumeric quote fields that every required symbol must contain. Default: ['close']
timeframesarrayShared timeframes for the overview. Default: ['15','60','240','1D']

get_execution_snapshot

Observe read-only TradingView scanner bid/ask conditions for one or more symbols. It normalizes spread and tick/pip units, rejects crossed quotes and delayed data, and reports ready only when a streaming bid/ask change is observed after the request. It does not access accounts or create, modify, or execute orders.

ParameterTypeDescription
symbols *array
max_quote_age_msintegerMaximum age of chart lp_time or a locally observed scanner update. Default: 5000
sample_interval_msintegerPolling interval while waiting for an update. Default: 300
wait_for_update_msintegerHow long to poll for a post-request bid/ask change. Default: 1200

get_closed_mtf_summary

Summarize SMA20/50/200, EMA20, RSI14 and ATR14 from successor-confirmed native OHLC at one cutoff. Never uses scanner values or guesses daily/weekly close times. Reuses matching layout charts; missing timeframes require confirm=true for temporary switching and verified restoration. Loaded history only; no trade signals or journal writes.

ParameterTypeDescription
expected_timeframe *string
symbol *string
chart_indexinteger
confirmboolean
countinteger
timeframesarray

get_closed_chart_snapshot

Capture original and requested successor-confirmed native bars and indicators for up to four displayed panes at one cutoff, plus separately timestamped execution quotes. Exact exchange-qualified bindings are required. Temporary timeframe changes need confirm=true. Holds the shared lock through whole-layout Study ID/timeframe/selection restoration checks. Manual drift, Replay or restoration failures block evidence. No symbol/study changes, history loading, orders, scenario rules, delivery or journal writes. The selected pane must be among targets when switching.

ParameterTypeDescription
targets *array
confirmboolean
countinteger
recent_countinteger
timeframesarray

prepare_native_bar_recording

Preview a process-local, single-use 10-minute recording plan. No chart access, lock or file/directory creation. Only displayed PEPPERSTONE:MXNJPY/OANDA:XAUUSD, native 15/60, at most 40 confirmed bars each. Explicit per-invocation human approval is separate from confirm/hash; policy is not consent. No automatic collection or deletion.

ParameterTypeDescription
targets *array

record_native_bar_snapshot

Only after separate explicit human approval, consume this process's live recording plan and capture fresh native bars. Store lock precedes shared chart lock; complete layout/Study ID/timeframe/selection restoration precedes immutable persistence. No caller OHLC, imports, backdating, quotes, orders, journals, notification decisions or automation changes. A first attempt may initialize metadata even if capture fails. Temporary 15/60 pane changes are fully restored. On uncertain outcome query the original recording id; never blindly recapture. Production maintenance remains disabled pending ancho…

ParameterTypeDescription
confirm *boolean
plan_hash *string
plan_id *string

get_native_bar_recording_status

Read-only original recording-id lookup: committed, pending, pruned, quarantined, maintenance_incomplete or not_found. Never recaptures, initializes storage, acquires a chart lock or changes timestamps.

ParameterTypeDescription
recording_id *string

get_native_bar_history

Read bounded committed local native-bar first-seen and observed revision occurrences. No CDP, locks, writes or carry-forward market truth. Context epochs remain separate; retention and omitted older occurrences are explicit. Not a scenario or notification decision.

ParameterTypeDescription
symbol *string
timeframe *string
limitinteger

get_native_bar_history_as_of

Read last locally observed occurrences with both observed_at AND logical recorded_at at/before as_of. Exact historical query visibility is not proven. No later revision backfill, chart access, writes or inferred availability.

ParameterTypeDescription
as_of *string
symbol *string
timeframe *string
limitinteger

prepare_native_bar_history_prune

Read-only exact expired batch preview (older than 90 elapsed days); separate deletion approval required. No automatic cleanup or chart access. Production execution is disabled pending anchored filesystem operations; the preview lists the exact scope and blocker but issues no plan.

prune_native_bar_history

Production execution currently refuses without filesystem changes: anchored filesystem operations are not yet available. Synthetic-only implementation: only after separate human approval, consume this process's exact live maintenance plan. Revalidate under writer lock, publish durable intent, delete only listed owned expired receipt/payload pairs. Interrupted maintenance blocks history until a separately previewed and approved recovery. Never changes charts, scenario/notification rules or Dot; recording consent does not authorize maintenance.

ParameterTypeDescription
confirm *boolean
plan_hash *string
plan_id *string

prepare_native_bar_clock_recovery

Read-only exact >1-minute clock-ahead batch preview; separate approval required for byte-preserving quarantine, never restamping or deleting. No chart access. Production execution is disabled pending anchored filesystem operations; the preview lists the exact scope and blocker but issues no plan.

recover_native_bar_clock_ahead

Production execution currently refuses without filesystem changes: anchored filesystem operations are not yet available. Synthetic-only implementation: only after separate human approval, consume this process's exact live maintenance plan. Revalidate under writer lock, publish durable intent, quarantine only listed owned clock-ahead pairs without overwriting or restamping. Interrupted maintenance blocks history until a separately previewed and approved recovery. Never changes charts, scenario/notification rules or Dot; recording consent does not authorize maintenance.

ParameterTypeDescription
confirm *boolean
plan_hash *string
plan_id *string

evaluate_fixed_scenario

Compare caller-supplied fixed close-band conditions with bounded native confirmed bars. Explicit timeframe branches are OR; strict band crossings, boundary equality, streaks, gaps and incomplete evidence remain distinct. Returns definition version/hash, original scenario text, comparison window and exact supporting bars. Unspecified rules are never invented; both activation/invalidation matches have no implicit lifecycle precedence. Stateless arithmetic only: no chart, lock, quotes, automation, notification decisions, orders, persistence or journal access. A match is not a new state transition…

ParameterTypeDescription
definition *object
evidence *object
expected_conditions_sha256 *
previous *

get_trade_decision_context

Build one read-only evidence bundle for trade analysis from a symbol-bound TradingView chart, OHLCV, key levels, scanner MTF/quotes, events, COT, U.S. real yield, and bid/ask execution evidence. decision_status reports only data and gate readiness; it never produces a directional recommendation or changes charts, Pine, alerts, orders, or journals.

ParameterTypeDescription
expected_timeframe *string
symbol *string
auxiliary_symbolsarray
chart_indexinteger
countriesarray
event_blackout_after_minutesinteger
event_blackout_before_minutesinteger
execution_max_quote_age_msinteger
execution_sample_interval_msinteger
execution_wait_for_update_msinteger
fieldsarray
include_positioningboolean
include_real_yieldboolean
key_level_limitinteger
key_level_range_percentnumber
min_importancestring
minimum_event_importancestring
ohlcv_countinteger
require_positioningboolean
require_real_yieldboolean
timeframesarray

get_real_yield_context

Get the latest official U.S. Treasury 10-year par real yield. This is end-of-day macro context, not an intraday trigger. Pass as_of to read only locally persisted versions first seen by that time.

ParameterTypeDescription
as_ofstringPoint-in-time cutoff as an ISO-8601 timestamp. Omit for the latest official feed.

get_policy_rate_context

Read only locally first-seen policy-rate versions that were available by the requested time. TradingView decision-date bars are never treated as intraday publication timestamps; this is macro context, not a trading trigger.

ParameterTypeDescription
as_ofstringPoint-in-time cutoff. Omit for the current time.
currenciesarray

get_exploratory_policy_rate_history

Read separately stored official revised policy-rate history for exploratory research only. It never asserts historical availability and must not be used as prospective or out-of-sample carry evidence.

ParameterTypeDescription
currenciesarray

carry_panel_preflight

Check whether locally first-seen policy-rate evidence can support a fixed carry panel before any return study runs. It uses only first-seen, available-at policy rates, counts non-overlapping business-day anchors, and returns not_evaluable instead of inventing history.

ParameterTypeDescription
from *string
pairs *array
to *string
as_ofstring
fixed_regimeobject
horizon_business_daysinteger
minimum_observationsinteger
oos_fromstring
price_evidencearray

measure_carry_panel_dependence

Measure actual pairwise return correlation and block-bootstrap design effect for a fixed daily FX panel before a carry primary test. It temporarily switches the requested chart for each pair, loads only the requested history, and restores it after every pair. This measures price-panel dependence only; it does not invent policy-rate vintages or run a carry-return study.

ParameterTypeDescription
pairs *array
seed *string
block_length_anchorsinteger
confirmboolean
countinteger
horizon_business_daysinteger
iterationsinteger
use_exploratory_official_rate_signsboolean

get_oanda_flow_collection_readiness

Read whether the local OANDA retail-flow collector is configured, without making a network request or exposing credentials. The source is limited to OANDA-client order and position percentages, not market-wide order flow.

get_carry_core_primary_readiness

Read the frozen carry_core_primary_v1 collection readiness without switching a chart. It combines first-seen policy rates with complete collection heartbeats, rounds the evidence start onto the frozen 20-business-day anchor grid, and reports current heartbeat-gap status.

ParameterTypeDescription
as_ofstring

run_carry_core_primary_test

Run the frozen carry_core_primary_v1 specification on the five-pair core FX panel. It uses only locally first-seen policy-rate versions that were available by each anchor-date close, fits pair fixed effects, and refits the regression in anchor-date moving-block bootstrap samples. It returns not_evaluable until the pre-registered first-seen history has at least 60 complete anchor-date clusters.

ParameterTypeDescription
chart_index *integer
as_ofstring
confirmboolean
countinteger

estimate_carry_panel_effective_sample

Estimate the precision-equivalent sample size of an already fixed carry panel before its primary test. It resamples whole anchor-date cross-sections in circular moving blocks, preserving same-date pair dependence and serial dependence. It is a planning diagnostic only, never an adoption rule or a return-study runner.

ParameterTypeDescription
observations *array
seed *string
block_length_anchorsinteger
iterationsinteger

get_cme_gold_open_interest

Get CME's Daily Bulletin aggregate open interest for COMEX Gold futures (TOTAL GC FUT). This is an exchange-wide all-listed-month total, independent from TradingView chart indicators. The observation is appended to the local first-seen history so a later analysis can distinguish what was initially published from a final revision. It never changes a chart, Pine script, alert, or order.

get_futures_flow_context

Combine one exact TradingView CME/COMEX/CBOT/NYMEX continuous-futures daily chart with delayed CFTC COT positioning, trailing volume z-scores, daily Open Interest (OI) 4-quadrant analysis, and contract roll anomaly detection. This is a market-participation proxy, not realtime institutional order flow, and it never changes the chart.

ParameterTypeDescription
expected_futures_symbol *stringExact continuous futures symbol required by the fixed mapping
futures_chart_index *integer
target_symbol *stringSupported spot target mapped to 6E, 6J, 6B, 6A, 6C, 6S, 6N, ES, NQ, YM, GC, SI, CL
as_ofstringPoint-in-time cutoff for locally first-seen CME Daily Bulletin OI. Supported only with open_interest_provider: cme_daily_bulletin; omit for the latest locally observed CME version.
cot_weeksintegerRecent delayed CFTC observations to include. Default: 2
countintegerMost recent loaded daily futures bars to inspect. Default: 1000
elevated_volume_z_scorenumberAbsolute z-score threshold for elevated/subdued participation. Default: 1.5
minimum_observationsintegerMinimum normalized daily observations. Default: 20
observation_limitintegerMaximum recent normalized observations returned. Default: 20
open_interest_dataarrayCaller-supplied daily Open Interest observations (time ISO/epoch, openInterest value)
open_interest_plot_titlestringPlot title or id carrying open interest on open_interest_study_id
open_interest_providerstringDaily OI source. Default chart reads a bound TradingView study; cme_daily_bulletin uses only locally first-seen official GC totals and is supported for XAUUSD.
open_interest_scopestringRequired with caller-supplied OI or an explicitly named OI study, and rejected without either; keeps front-month and all-months data separate
open_interest_study_idstringRead daily OI from this on-chart study instead of the official Open Interest study, e.g. an aggregated all-months OI indicator
roll_anomaly_thresholdnumberDaily Open Interest change ratio threshold for contract roll anomaly detection. Default: 0.20 (20%)
volume_lookbackintegerPrior bars used for volume mean and z-score. Current bar is excluded. Default: 20

get_cot_crowding_unwind_overlay_template

Get the audited Pine overlay that renders a supplied COT crowding context and the chart's prior daily structure range. COT values are explicit MCP inputs; the overlay does not fetch or infer CFTC data, orders, stops, or execution flow.

get_cot_crowding_unwind_context

Describe an exploratory COT crowded-position unwind proxy on a bound daily FX chart. It combines leveraged-money three-year positioning percentiles with a prior-20-day price break; it never claims to observe orders, stops, institutions, or execution flow.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
chart_indexinteger
countinteger

get_positioning_context

Get the latest or recent public CFTC COT positioning proxy for a supported FX or gold symbol. COT is weekly, delayed futures data, not a realtime order-flow signal.

ParameterTypeDescription
symbol *stringSupported: OANDA:EURUSD, USDJPY, GBPJPY, GBPAUD, XAUUSD
weeksintegerNumber of weekly observations. Default: 1

reconcile_gold_open_interest

Reconcile CFTC Gold COT open interest with locally first-seen official CME Daily Bulletin TOTAL GC FUT open interest. Only identical report/observation calendar dates are compared; missing dates are returned as quality evidence and are never nearest-date matched or filled.

ParameterTypeDescription
as_ofstringPoint-in-time cutoff for the local CME first-seen history. Omit for the latest locally observed official values.
weeksintegerCOT report weeks to inspect. Default: 12

compute_correlation_regimes

Classify rolling return correlation between two explicitly bound layout charts. Closed bars must share an exact UTC timestamp; missing bars are never forward-filled. This is descriptive evidence, not a trading signal.

ParameterTypeDescription
expected_primary_symbol *string
expected_reference_symbol *string
expected_timeframe *string
primary_chart_index *integer
reference_chart_index *integer
countinteger
neutral_thresholdnumber
strong_thresholdnumber
windowinteger

preflight_cross_asset_shock

Coverage preflight for the cross-asset shock study. It binds an EURUSD or USDJPY target chart, then temporarily reuses one auxiliary chart for DXY, US10Y, and XAUUSD at the same 5 or 15 minute timeframe, restoring that auxiliary chart after each read. An optional explicit history load can add older bars but never changes symbols or timeframes persistently. Only exact UTC closed-bar intersections are counted; no shock threshold, direction, outcome, order-flow claim, or trading instruction is produced.

ParameterTypeDescription
auxiliary_chart_index *integer
expected_target_symbol *string
expected_timeframe *string
target_chart_index *integer
countinteger
load_more_barsintegerAdditional history to request for the target and each temporary context before reading. Default: 0
minimum_aligned_barsinteger

classify_cross_asset_shocks

Classify observed EURUSD or USDJPY shocks after exact-time cross-asset collection. It temporarily uses one auxiliary chart for DXY, US10Y, and XAUUSD, restores it after each read, and applies the frozen same-UTC-slot baseline contract. It reports observed state only, never a forward outcome, candidate, order-flow claim, or trading instruction.

ParameterTypeDescription
auxiliary_chart_index *integer
expected_target_symbol *string
expected_timeframe *string
target_chart_index *integer
countinteger
load_more_barsintegerAdditional history to request for the target and each temporary context before reading. Default: 0
minimum_classified_statesinteger
state_limitintegerMaximum latest classified state rows to return. Aggregate counts use every eligible row. Default: 200

evaluate_cross_asset_shock_outcomes

Measure descriptive 15/30/60/120-minute outcomes for frozen observed cross-asset shock states. It uses exact-time common bars, excludes overlapping state windows, and never produces a candidate or trade instruction.

ParameterTypeDescription
auxiliary_chart_index *integer
expected_target_symbol *string
expected_timeframe *string
target_chart_index *integer
countinteger
event_limitinteger
load_more_barsinteger
minimum_events_per_stateinteger

preflight_bookmap_flow_price_join

Read a local Bookmap Collector session and verify its conservative, receipt-time-only join coverage to the active EURUSD M1 or M5 chart. Bookmap CME flow is retained as a single-venue futures proxy, never presented as spot-FX-wide flow. This preflight creates no candidate, outcome study, chart change, or order.

ParameterTypeDescription
expected_symbol *string
expected_timeframe *string
countinteger
interval_seconds
minimum_intervalsinteger
session_filestringCollector JSONL basename. Default: latest lexicographic session in the configured local directory

run_external_label_study

Measure forward outcomes for caller-supplied point-in-time labels on the active chart, so an external series such as daily open interest, settlement statistics or survey data can be tested with the same outcome, fold, interval and journal machinery as the built-in conditions. Each label is attached to a bar at least one bar after the one it carries, because an external label is rarely public when its own bar closes; a zero lag is refused rather than trusted. Horizons count subsequent observed bars, so a daily series is not voided by weekends. Unlike run_market_event_study this accepts daily an…

ParameterTypeDescription
accepted_labels *arrayLabels to evaluate and the direction each one implies. Other labels are counted and dropped
expected_symbol *string
expected_timeframe *string
horizons *array
minimum_events *integer
observation_lag_bars *integerClosed bars between the observation bar and the signal bar. Minimum 1
observations *arrayPoint-in-time labels. time must identify a loaded bar, exactly or by a UTC date only one bar carries
target_return_bps *number
confidence_level
configuration_trialsinteger
countintegerMost recent loaded bars to inspect. Default: 1000
event_limitintegerMaximum per-event rows to return. Aggregate metrics always use all events. Default: 50
foldsarray
journalobject
overlap_policystringExclude later events whose window overlaps an earlier one, or keep them for a dense daily label series and accept intervals narrower than the effective sample. Default: exclude_later_event

compute_lead_lag_relationships

Scan return correlation between two explicitly bound layout charts across a symmetric range of lags, so a caller can see whether a reference market leads the primary. Closed bars must share an exact UTC timestamp; missing bars are never forward-filled. The v3 default scales each return by its own series' prior-20-return RMS without using the current return. Every scanned lag is returned with its own interval and per-fold stability, and no best lag is selected. Shared clustered-volatility calibration still exceeds nominal alpha, so candidate eligibility and journal promotion remain disabled. De…

ParameterTypeDescription
expected_primary_symbol *string
expected_reference_symbol *string
expected_timeframe *string
primary_chart_index *integer
reference_chart_index *integer
alignment_modestringDefault exact_utc joins only identical bar timestamps. The resampling mode temporarily reads both charts at closed 60-minute bars and rebuilds a common UTC grid at expected_timeframe; use it only when…
confidence_level
configuration_trialsintegerTotal related scans inspected so far, including this one. Applied with all scanned lags as the Bonferroni family. Default: 1
countinteger
empirical_null_calibrationbooleanRun the fixed 1,000-replication circular-shift empirical-null calibration on this exact pair. Required for the statistical gate; public candidate eligibility remains disabled pending shared-volatility…
foldsarray
journalobjectRecord this scan as evidence. Only tradable positive lags are stored; a scan can never be adopted, so decision must be rejected or inconclusive.
max_lag_barsintegerScan every lag from -max_lag_bars to +max_lag_bars. Default: 10
minimum_observationsintegerLags with fewer paired returns are reported as insufficient. Default: 30
return_standardizationstringDefault causal_prior_20_rms uses only each return's prior 20 returns for scale. none reproduces the invalidated raw-return v2 contract.

get_aligned_history

Align closed OHLCV bars already loaded in two or more TradingView layout charts on their exact UTC timestamps. It never changes charts and never forward-fills; forming bars, different resolutions, missing bars, and retrieval failures are reported as quality conditions. Use a layout where each required market is already open.

ParameterTypeDescription
chart_indexesarrayCharts to align. Default: every chart in the current layout; at least two are required
countintegerClosed bars to inspect per chart before alignment. Default: 200
max_missing_rationumberBlock when the worst chart's timestamp-missing ratio exceeds this value. Default: 0.05

validate_research_protocol

Validate a frozen strategy-research protocol before adoption decisions. Resolves and statically audits one exact saved Pine strategy version, then checks IS/OOS overlap, future windows, forming-bar use, candidate multiplicity, minimum trades, explicit costs, restart-difference evidence, and definition changes after OOS access. This is read-only and does not run a backtest, inspect the chart, or prove non-repainting.

ParameterTypeDescription
candidate_ids *array
closed_bars_only *boolean
costs *object
definition_frozen_at *string
definition_last_changed_at *string
minimum_trades *integer
pine_id *string
pine_version *string
restart_diff_checked *boolean
windows *array
observed_trades
oos_first_viewed_at

audit_pine_indicator

Statically audit one of the user's Pine scripts for constructs that can repaint or make realtime values differ from historical values. This is a source-level screen, not proof of non-repainting; every result remains restricted until restart-difference validation is recorded by the evaluation pipeline.

ParameterTypeDescription
pine_id *stringYour Pine script id from list_pine_scripts
versionstringPine version to inspect. Default: last

compare_indicator_observations

Compare two closed-bar captures of the same indicator after a chart reload/restart. Returns changed plot values; it does not persist either capture.

ParameterTypeDescription
after *object
before *object
epsilonnumber

compute_market_features

Compute deterministic, non-directional features from exact-time-aligned closed OHLCV observations, typically returned by get_aligned_history: close-to-close return, realized volatility, ATR, and return correlations. It does not fetch data, fill gaps, or produce a trade recommendation.

ParameterTypeDescription
observations *arrayExact-time-aligned, closed-bar observations from get_aligned_history
primary_symbol *stringSymbol whose return, volatility, and ATR to compute
windowintegerNumber of latest observations. Default: 20

compute_cost_adjusted_risk_reward

Compute conditional gross and cost-adjusted reward/risk from caller-supplied entry, stop, target and bid/ask. Declare one common bid/ask/mid basis for all levels, or executable basis when entry and exits already use their respective execution sides. Applies the supplied constant spread once per round trip, never again for executable basis. Entry/stop/target adverse slippage and a total round-trip fee are required, all in the declared native price unit; explicit zero is allowed. Reports modeled buy-at-ask/sell-at-bid scenarios, separate stop/target costs and signed net profit/ratio. Pure arithm…

ParameterTypeDescription
ask *number
bid *numberCaller-supplied quote; used for spread only, not as proof of freshness.
direction *string
entry_price *number
entry_slippage_price *numberAdverse entry price movement, in price_unit; zero must be explicit.
price_basis *stringBasis of all levels. Executable: entry already uses entry-side quote, exits use opposite-side quote, before fees/slippage.
price_unit *stringCaller-declared common price unit, e.g. JPY per MXN or USD per troy ounce. Not independently verified.
round_trip_fee_price *numberTotal fee for entry plus one exit, already converted to price_unit; charged once per scenario, not per side.
stop_price *number
stop_slippage_price *numberAdverse exit movement in the stop scenario, in price_unit.
symbol *string
target_price *number
target_slippage_price *numberAdverse exit movement in the target scenario, in price_unit; not a limit-order fill guarantee.

compute_round_trip_cost

Compute explicit round-trip spread, slippage, and commission cost for a supported instrument. This is an assumption model, not broker execution data.

ParameterTypeDescription
ask *number
bid *number
quantity *number
symbol *string
commission_per_unitnumber
slippage_pips_per_sidenumber

compute_backtest_overfitting

Estimate the probability of backtest overfitting (PBO) of choosing the best of several configurations, by combinatorially symmetric cross-validation (Bailey, Borwein, Lopez de Prado and Zhu 2017). Give every configuration tried, discarded ones included, as per-period returns aligned in time (row t is the same period for every configuration). The periods are split into an even number of contiguous blocks (default 16, giving 12,870 splits); on each split the configuration with the best training Sharpe ratio (mean / sd with n - 1, no risk-free rate; a set of all-zero returns counts as 0) is ranke…

ParameterTypeDescription
configurations *arrayEvery configuration tried, each with a unique id and the same number T of aligned per-period returns; at most 500,000 returns in total
blocksintegerAn even number of contiguous blocks, 2 to 16, with T >= 2 x blocks. Default: 16 (12,870 splits); at least 20 periods per block are recommended

compute_deflated_sharpe

Deflate a selected configuration's Sharpe ratio for the number of configurations tried: the probabilistic Sharpe ratio, the expected maximum Sharpe ratio of N unskilled trials, the deflated Sharpe ratio (Bailey and Lopez de Prado 2014) and the minimum backtest length (Bailey et al. 2014). Units decide whether the answer means anything: every Sharpe ratio is PER PERIOD of the returns, computed as mean / standard deviation (T - 1) with no risk-free rate, over the same sample and length for every trial. Divide an annualized Sharpe ratio by sqrt(periods per year) and an annualized variance by the…

ParameterTypeDescription
returns *arrayThe selected configuration's per-period returns, in one unit, magnitude at most 1e300
effective_trial_countintegerWith trial_sharpes: the effective number of independent trials, when trials are correlated or grouped
periods_per_yearnumberAnnualizes the Sharpe ratio for display, gives the minimum backtest length in periods, and enables the unit checks
target_annual_sharpenumberThe annualized Sharpe ratio the minimum backtest length guards against, from 1e-4 to 1e4. Default: 1
trial_countintegerInstead of trial_sharpes: the number of (effectively independent) configurations tried
trial_sharpe_variancenumberWith trial_count: the variance of the trials' per-period Sharpe ratios (divide an annualized variance by the periods per year)
trial_sharpesarrayPer-period Sharpe ratios (mean / sd with T - 1, no risk-free rate) of every configuration tried, the selected and discarded ones included, over the same sample and length

compute_reality_check

Test whether the best of several configurations beats a benchmark once the search over them is accounted for: White's Reality Check (2000) and Hansen's test for superior predictive ability (SPA, 2005) by the stationary bootstrap. Give every configuration tried, discarded ones included, as per-period returns aligned in time, and optionally the benchmark's returns over the same periods (default: zero, testing for a positive mean). Performance is the mean return in excess of the benchmark, not risk-adjusted. Returns the Reality Check p-value (its best is the configuration with the highest mean di…

ParameterTypeDescription
configurations *arrayEvery configuration tried, each with a unique id and the same number n of aligned per-period returns (10 to 100,000); at most 500,000 returns in total
benchmarkarrayThe benchmark's per-period returns over the same n periods. Default: zero
drawsintegerBootstrap draws, 100 to 10,000. Default: 2,000
mean_blocknumberThe stationary bootstrap's mean block length in periods, from 1 (i.i.d.) to n/2; fractional values are allowed. Default: round(n^(1/3))
seedintegerSeed of the bootstrap's generator. Default: 20261011

compute_position_size

Compute a risk-budgeted instrument quantity from entry, stop, explicit execution cost, quantity constraints, and fresh quote-to-account currency evidence. The quantity is always rounded down and the tool fails closed when conversion evidence or minimum-size capacity is missing. It does not access an account or place an order.

ParameterTypeDescription
account_currency *string
account_equity *number
entry_price *number
minimum_quantity *number
quantity_step *number
stop_price *number
symbol *string
contract_multipliernumber
conversion_observed_atstring
conversion_symbolstring
max_conversion_age_secondsnumber
maximum_quantitynumber
quote_to_account_ratenumberAccount-currency units per one quote-currency unit
risk_amountnumber
risk_percentnumber
round_trip_cost_price_per_unitnumber

validate_trade_plan

Validate a proposed trade plan without changing TradingView, Pine, alerts, orders, or journals. Returns structured quality issues and cost-adjusted Target 1 risk/reward.

ParameterTypeDescription
analysis_id *string
analyzed_at *string
bias *string
confidence *number
current_price *number
entry_high *number
entry_low *number
invalidation *number
market_observed_at *string
stop *number
symbol *string
targets *array
timeframe *string
confirmationnumber
estimated_round_trip_cost_pricenumber
event_blackout_after_minutesinteger
event_blackout_before_minutesinteger
eventsarray
expires_atstring
max_market_age_secondsinteger
minimum_event_importancestring
minimum_risk_rewardnumber
notestring

get_mtf_overview

Multi-timeframe overview of one or more symbols WITHOUT touching the user's chart: the same indicator fields (default: close, RSI, ADX, ATR, EMA20, SMA50, SMA200 and Recommend.* ratings) across several timeframes in a single call — pass several symbols to compare majors side by side in one call. Use this for top-down analysis (e.g. 1D trend, 240/60 timing) before or instead of set_timeframe.

ParameterTypeDescription
symbols *arraySymbols in EXCHANGE:SYMBOL form, e.g. ['OANDA:EURUSD', 'OANDA:USDJPY']
fieldsarrayIndicator fields without timeframe suffix. Default: common trend/momentum set
timeframesarrayTimeframes (minutes or 1D/1W/1M). Default: ['15','60','240','1D']

scan_market

Screen a market for symbols matching field filters via TradingView's scanner API, e.g. RSI < 30 sorted by volume. Markets: 'america', 'japan', 'crypto', 'forex', 'global', etc. Filter fields use scanner names like 'RSI', 'close', 'volume', 'change', 'market_cap_basic', 'Recommend.All'.

ParameterTypeDescription
market *stringMarket to screen, e.g. 'japan', 'america', 'crypto', 'forex'
columnsarrayData fields to return per match
filtersarrayConditions, e.g. [{field:'RSI', operation:'less', value:30}]
limitintegerMax results. Default: 20
sort_bystringField to sort by, e.g. 'volume'
sort_orderstringDefault: desc

get_moving_average_context

Map moving-average settings to native plot values by an explicit study identity and input/plot IDs, not a similar display name. V1 supports the observed ten-line Simple Moving Averages study only; other studies remain unmapped. Reports period, SMA method, price source, visibility, exact successor-confirmed bar times and the difference between adjacent confirmed values, with elapsed seconds. Checks both values against loaded native OHLC when enough history exists. Unknown offsets/sources, study errors, absent exact plot times or numeric mismatches never produce a substituted value. Read-only un…

ParameterTypeDescription
expected_timeframe *string
symbol *string
chart_indexinteger
countintegerLoaded native and study rows including the unconfirmed tail. Default: 500

get_ohlcv_key_levels

Extract descriptive swing levels directly from successor-confirmed native OHLC, without indicators or scanner fallback. Fixed strict 3-left/3-right pivots; earliest seed prices stay fixed when merging within 5 bps. Reports post-confirmation touch episodes, confirmed same-side rejections, last-touch times, provenance and filter denominators. Uses provider-bound session/timezone/holiday/correction metadata to retain declared closures and exclude missing or unclassified intervals; never assumes generic holidays. Read-only on the bound chart; no timeframe changes, history loading, drawings, tradin…

ParameterTypeDescription
expected_timeframe *string
symbol *string
chart_indexinteger
countintegerLoaded native bars including the unconfirmed tail. Default: 500
limitintegerNearest levels to return; pre-filter counts remain visible. Default: 30
range_percentnumberSeed levels within this percent of the last confirmed close. Default: 3

get_key_levels

Aggregate key price levels near the current price from ALL price-scale indicators on a TradingView chart: plot values whose titles name a level (S/R, pivot, VWAP, bands, BOS/CHoCH...), horizontal lines, box/zone edges and label prices, each tagged with its source indicator. Oscillator panes (RSI etc.) and generic value plots (open/high/low/close mirrors) are excluded. Sorted by distance from the current price. Use this instead of manually combining get_indicator_values and get_indicator_graphics when you need a support/resistance table.

ParameterTypeDescription
chart_indexintegerChart index in a multi-chart layout. Default: the active chart
include_all_plotsbooleanInclude every numeric plot as a level, not just level-named ones. Use when an indicator names its S/R plots unusually. Default: false
limitintegerMax levels to return, nearest first. Default: 30
range_percentnumberOnly levels within ±this % of the current price. Default: 3

get_economic_events

Get economic calendar events (CPI, NFP, central bank decisions, PMIs...) from TradingView's public calendar: scheduled time, country/currency, importance, forecast/previous/actual values. Use this to check whether upcoming news could invalidate a technical setup. Defaults: next 7 days, medium+ importance, US/EU/JP/GB.

ParameterTypeDescription
countriesarray2-letter country codes, e.g. ['US','JP','EU','GB','DE','CN','AU']. Default: US, EU, JP, GB
fromstringRange start, ISO 8601 (e.g. '2026-07-08T00:00:00Z'). Default: now
limitintegerMax events to return, earliest first. Default: 50
min_importancestringMinimum importance to include. Default: medium
tostringRange end, ISO 8601. Default: from + 7 days

set_symbol

Change one TradingView chart to a different symbol, e.g. 'BTCUSD', 'OANDA:EURUSD', 'NASDAQ:AAPL'. A symbol without an exchange prefix takes the exchange TradingView resolves it to, and the result reports that resolved symbol. chart_index selects a pane in multi-chart layouts; the active chart is used by default. The target pane is read back and failures are rolled back.

ParameterTypeDescription
symbol *stringSymbol to display, optionally exchange-prefixed; with a prefix it must resolve exactly
chart_indexintegerChart index in a multi-chart layout. Default: active chart

set_timeframe

Change one TradingView chart's timeframe. Examples: '1', '5', '15', '60', '240' (minutes), '1D', '1W', '1M'. chart_index selects a pane in multi-chart layouts; the target pane is read back and failures are rolled back.

ParameterTypeDescription
resolution *stringTimeframe/resolution string
chart_indexintegerChart index in a multi-chart layout. Default: active chart