How to configure TradingView Pine Script strategies by hand?
How to configure TradingView Pine Script strategies by hand?
Section titled “How to configure TradingView Pine Script strategies by hand?”TL;DR
Use the strategy Properties tab to adjust capital, order sizing, commission, leverage, and recalculation without editing code.
At a Glance
Section titled “At a Glance”| Difficulty | Beginner |
| Time to implement | 10-15 min |
| Category | Strategy Basics |
Quick Actions
Section titled “Quick Actions”Why It Matters
Section titled “Why It Matters”Not every tweak requires changing code. TradingView’s UI settings let you tailor a strategy to different symbols, capital sizes, or broker conditions while keeping the underlying script identical.
Quick Reference (Properties Tab)
Section titled “Quick Reference (Properties Tab)”| Setting | Purpose |
|---|---|
| Initial Capital | Starting equity for the backtest. |
| Base Currency | Currency used for equity, P/L, and commission. |
| Order Size | Default sizing mode (contracts, cash, percent of equity). |
| Pyramiding | Max number of entries per direction. |
| Commission | Per-trade fee model (fixed, per contract, percent). |
| Verify Price for Limit Orders | Extra ticks beyond price touch before filling limits. |
| Slippage | Per-order price slippage in ticks. |
| Margin (Long/Short) | Leverage configuration for both sides. |
| Recalculate after Order is Filled | Re-run strategy mid-bar once fills occur. |
| Recalculate on Every Tick | Force intrabar evaluation at tick granularity. |
Implementation Blueprint
Section titled “Implementation Blueprint”-
Open the Properties tab
Right-click the chart → Settings or click the settings gear on the strategy’s legend, then select Properties. -
Adjust key parameters
Tune capital, order size, commission, and leverage to match your scenario. -
Save presets as needed
The same strategy can run with different settings per chart; use “Make default” if you want new charts to inherit these values.
Example Playbook
Section titled “Example Playbook”//@version=5strategy("Manual settings demo", overlay=true)
fastLen = input.int(10)slowLen = input.int(30)
fast = ta.ema(close, fastLen)slow = ta.ema(close, slowLen)
plot(fast, "Fast EMA", color=color.green)plot(slow, "Slow EMA", color=color.red)
if ta.crossover(fast, slow) strategy.entry("Buy", strategy.long)
if ta.crossunder(fast, slow) strategy.entry("Sell", strategy.short)- The same simple EMA strategy can mimic different brokers by altering Properties.
- No code changes are required to test cash vs. percent sizing or to add commission and slippage.
- Recalculation options let you explore intrabar behaviour without rewriting logic.
Pro Tips & Pitfalls
Section titled “Pro Tips & Pitfalls”- Manual settings override defaults from
strategy(); document what you change so others can reproduce results. - Pyramiding affects both code-driven orders and manual overrides—make sure it aligns with your logic.
- High slippage or commission values can drastically alter performance; use realistic numbers.
Recalculate on every tickincreases computation; reserve it for strategies needing tick-level accuracy.
Troubleshooting & FAQ
Section titled “Troubleshooting & FAQ”Why does my strategy stop trading after a few losses?
Section titled “Why does my strategy stop trading after a few losses?”If order size is cash- or percent-based, equity declines can reduce buying power. Adjust initial capital, leverage, or order sizing to ensure trades can still execute.
Do manual settings persist across charts?
Section titled “Do manual settings persist across charts?”They’re stored per script per chart. Use “Make default” if you want new chart instances to inherit your preferred configuration.
Key Takeaways
Section titled “Key Takeaways”- The Properties tab offers fast, code-free adjustments to capital, sizing, fees, and margin.
- Manual tweaks complement
strategy()arguments—use both to build flexible scripts. - Align manual settings with real-world broker conditions for realistic backtests.
Keep Going
Section titled “Keep Going”- Open AI Editor to apply the pattern with guided assistance
- Browse PineScript Examples for ready-to-run templates
- Connect to Live Trading when you are ready to automate
Adapted from tradingcode.net, optimised for Algo Trade Analytics users.