How to Lock TradingView Strategy Properties for Comparable Backtests
The same Pine strategy can produce materially different Strategy Tester results when initial capital, base currency, order size, pyramiding, margin, commission or slippage changes. This is not a guide to choosing a supposedly best setting. It shows how to record what was fixed in code, what was overridden in the interface and which chart context produced the run, then bind that settings fingerprint to the exported result. Cost calculation and sensitivity testing remain in the dedicated BT09 lesson; the job here is reproducibility.
Who this guide is for: Traders and Pine developers whose Tester results differ across machines, shared copies or reruns, and anyone comparing strategy versions under a controlled premise
Key points to understand first
- Strategy Properties are experimental conditions that shape quantity, capital constraints and simulation assumptions—not decorative report fields.
- Preserve the script declaration, live Properties values and symbol/timeframe/session as one settings fingerprint.
- Change one item at a time and record the reason, unit, timestamp and resulting file under a new version ID.
- Record commission and slippage values here, but leave cost subtraction and sensitivity analysis to the dedicated BT09 guide.
- A settings-fingerprint completion rate measures documentation gaps; it does not score the best setting or predict future performance.
Name the experiment before reading its result
Capital
- Initial 100,000
- Currency USD
- Order 10% equity
Exposure
- Pyramiding 1
- Long margin 100%
- Short margin 100%
Friction
- Commission 0.05%
- Slippage 2 ticks
- Unit verified
Context
- Symbol ID saved
- Timeframe saved
- Session saved
Only results with a fixed premise and data context are comparable
Strategy Properties define the premise of a backtest experiment. Initial capital and currency set the reporting and capital base; order size and pyramiding shape exposure; margin changes capital requirements and margin-call behavior; commission and slippage represent assumed friction. Saving only net profit leaves the experiment impossible to reconstruct.
Save the settings record first, execute Strategy Tester second, then bind the result file and record with the same version ID. A statement such as “version B performed better” is interpretable only when symbol, timeframe, date range, session, script hash, inputs and properties are equal except for the one intended change. A different provider or accessible history is a different experiment too.
Separate capital, exposure, friction and calculation behavior
Treating the Properties panel as one long list hides why a field changed. Grouping fields into capital, exposure, friction and calculation/fill layers makes potential causes traceable. This article records the first three; TV15 covers recalculation timing and TV12 covers the broker emulator and fills.
| Layer | Representative fields | What can change | Evidence to retain |
|---|---|---|---|
| Capital | initial capital, currency | Percentage base and funding constraints | Value, currency, rationale |
| Exposure | order size, pyramiding, margin | Quantity, stacked entries, margin calls | Type, value, direction |
| Friction | commission, slippage | Post-fill P&L | Unit, value, per-fill meaning |
| Calculation/fill | recalculation and fill settings | Order creation and execution timing | Link to separate audit |
Interface labels and grouping can change. Prefer the current official page and the values shown in the actual run.
Ten percent of equity and a fixed quantity of 10 are not interchangeable. Likewise, a 100% versus 20% margin setting changes capital requirements; it is not a direct maximum-loss control. Reconcile actual position risk separately with stop distance, quantity, point value, gaps and contract terms.
Bind a settings fingerprint to every exported result
A fingerprint here is a compact human-readable identifier, not a cryptographic proof. The complete record stores value, unit, entry point, rationale, whether code fixed it or the UI overrode it, and review date. The short ID belongs in filenames and comparison tables. Preserve text as well as screenshots so differences remain searchable.
Fingerprint = script version + inputs + capital/currency + sizing + pyramiding + margin + friction + contextCompleteness = recorded required fields / required fields × 100Review flags = missing fields + suspected UI overridesThis measures record completeness, not strategy quality or profitability.| Field | Fictional example | Unit/type | Source |
|---|---|---|---|
| initial_capital | 100000 | USD | strategy() |
| default_qty | 10 | % of equity | strategy() |
| pyramiding | 1 | same-direction entry cap | strategy() |
| margin long/short | 100 / 100 | % | strategy() |
| commission | 0.05 | assumed % per fill | strategy() |
| slippage | 2 | ticks | strategy() |
| context | TICKERID / 60 / regular | ID, minutes, session | chart |
Values illustrate the recording method and are not recommendations.
Reconcile strategy() defaults with the live Properties values
Pine v6 lets a strategy declaration state many default properties. The sample exists only to show explicit settings. pyramiding = 1 records an intent to permit one same-direction entry at a time. Its moving-average cross is a short fictional rule, not evidence of an edge, a recommended length or a directional instruction. The commission and slippage values are fictional too.
//@version=6
strategy(
"Settings fingerprint demo",
overlay = true,
initial_capital = 100000,
currency = currency.USD,
default_qty_type = strategy.percent_of_equity,
default_qty_value = 10,
pyramiding = 1,
commission_type = strategy.commission.percent,
commission_value = 0.05,
slippage = 2,
margin_long = 100,
margin_short = 100
)
int fastLength = input.int(20, "Fast length", minval = 2)
int slowLength = input.int(50, "Slow length", minval = 3)
float fast = ta.sma(close, fastLength)
float slow = ta.sma(close, slowLength)
if ta.crossover(fast, slow) and barstate.isconfirmed
strategy.entry("L", strategy.long)
if ta.crossunder(fast, slow) and barstate.isconfirmed
strategy.close("L")
plot(fast, "Fast", color.teal)
plot(slow, "Slow", color.orange)Check the current compiler and official declaration reference before using any argument in Pine Editor.
Source defaults make a shared starting point easier to identify, but a runnable configuration can still differ if the corresponding Properties field is changed. Reconcile source, the live panel and the exported settings information. Assign a new fingerprint whenever an override matters.
Change one variable so a result difference has one named cause
Clone a frozen baseline and change one target field. Changing capital and sizing together makes it impossible to separate effects on amount, percentage and trade eligibility. When testing pyramiding, hold other properties, inputs, symbol and period constant, then retain trade count, exposure and margin events alongside the report.
- Freeze a baseline
Save script hash, inputs, properties, symbol, timeframe and date range.
- Change one field
Record the reason, old value, new value, unit, operator and time.
- Rerun the Tester
Export the same CSV/XLSX report type instead of comparing screenshots alone.
- Reconcile differences
Check the settings delta, trades, quantity, capital constraints and warnings in order.
- Freeze the version
Keep failed and unattractive variants so outcome does not rewrite the audit trail.
Varying commission, spread or slippage across scenarios asks a different question. Do not recreate that analysis here; continue to BT09 cost sensitivity and stress testing. TV11 identifies the exact baseline passed into that exercise.
Pass the CSV/XLSX downstream with its premise attached
After exporting a compatible Strategy Tester CSV/XLSX, store it beside the matching fingerprint. SG Group’s Backtest & Robustness Lab can then provide descriptive diagnostics such as KPIs, equity, drawdown, stress and OOS from the loaded results. When saved analyses and repeatable version comparison become important, the paid workflow is a natural next step.
The free TradingView indicator collection is useful for observation and hypothesis formation, but an indicator plot is not a Strategy Tester strategy export. Convert a precise rule into a separate `strategy()` specification, validate data, fills and execution, then send suitable results to the Lab. Do not relabel an attractive plot as tested performance.
Audit missing fields and overrides before sharing a result
- Record the strategy title, script version, Pine version and source hash.
- Record initial capital, currency, order-size type/value, pyramiding and margin by direction.
- Record commission and slippage value, unit and entry point; keep cost modeling in BT09.
- Save symbol ID, provider, timeframe, session, date range and adjustment context.
- Reconcile strategy() defaults against the values used in the Properties panel.
- Change one field at a time and preserve unsuccessful versions.
- Apply one fingerprint ID to the CSV/XLSX, settings record and run log.
Fixed settings do not guarantee future performance. Reproducibility is only the minimum condition for asking the same question again. Validate data quality, fills, execution, sample size, costs, OOS and robustness separately. Continue with TV12 for fill assumptions and TV15 for runtime timing.
Count documentation coverage and override flags
Enter required properties, fully recorded properties, code-declared properties and suspected UI overrides. This checks audit completeness, not performance.
Completeness = min(recorded, required) / required; code-explicit ratio = min(code fields, required) / required; flags = missing fields + suspected overrides. A complete record does not prove appropriate settings or a profitable strategy.
Frequently asked questions
Do saved Strategy Properties guarantee an identical rerun?
No. Script version, inputs, symbol ID, provider, timeframe, session, history range and data revisions must also be reconciled. The settings record is the starting point.
What is the correct commission or slippage value?
There is no universal value. It depends on broker, instrument, order, liquidity and time. This article records value and unit; BT09 handles modeling and sensitivity.
Can I skip the Properties panel when values are in source code?
No. Runtime overrides and chart-level context can still differ. Reconcile source, the panel and the run’s exported information.
Must the settings fingerprint be embedded inside the CSV?
No. A human-readable worksheet or JSON sidecar is acceptable, provided it is bound to the CSV/XLSX by the same version ID, run time and script hash.
Primary sources and verification links
- TradingView | Strategy propertiesOfficial properties and their relationship to strategy() arguments
- TradingView Pine Script | Declaration statementsOfficial strategy declaration and property argument reference
- TradingView Pine Script | StrategiesOfficial Strategy Tester, properties, orders, costs and margin concepts
- TradingView Pine Script FAQ | StrategiesOfficial FAQ for sizing, leverage and strategy testing
- TradingView Pine Script | Execution modelOfficial runtime context that must be separated from economic settings
Edited and published by: SG Group · Editorial approach: We prioritize official TradingView Help Center and Pine Script documentation, then use exchange, regulator and other primary materials for market and product context. Features, data, pricing and connection terms change, so verify the current interface and linked sources before use.
Important notice: This article provides general education about TradingView interfaces, charts, alerts, screeners, paper trading and Pine Script. It is not investment advice, a trading signal, a recommendation of any instrument, data source or broker, or a guarantee of future price or profit. Features, pricing, data, exchange coverage, notifications, order integrations and Pine Script behavior vary by plan, region, connection and date and may change. Before risking money, verify current TradingView documentation and the terms of the relevant data source and connected provider, then rehearse the workflow with fictional data or paper trading.

