TradingView पर Backtest कैसे करें — Complete Guide 2026
Backtesting historical data पर एक strategy test करना है यह देखने के लिए कि अतीत में इसने कैसा प्रदर्शन किया होता। असली पैसा risk करने से पहले strategy validate करने का यह एकमात्र विश्वसनीय तरीका है।
TradingView के पास बाजार में सबसे अच्छे free backtesting tools में से एक है — Strategy Tester। इस guide में, मैं आपको दिखाऊँगा कि इसे शुरू से कैसे उपयोग करें।
Backtesting क्या है?
यह real historical data के साथ आपकी strategy simulate करना है। उदाहरण के लिए: “यदि मैंने इस strategy को EUR/USD पर January से December 2025 तक चलाया होता, क्या मैं जीतता या हारता?”
⚠️ महत्वपूर्ण limitations
Backtesting दिखाता है कि क्या हुआ होता, यह नहीं कि क्या होगा। अतीत में profitable strategy भविष्य में fail हो सकती है (volatility shifts, market conditions)। Backtesting को filter के रूप में उपयोग करें, गारंटी के रूप में नहीं।
Indicator vs Strategy
TradingView पर Pine Script code के 2 types हैं:
| Type | Purpose | Backtesting? |
|---|---|---|
| Indicator | Chart पर signals दिखाता है | नहीं |
| Strategy | Automated entries/exits simulate करता है | हाँ ✅ |
Backtest करने के लिए, आपको indicator को strategy में convert करना होगा। AI यह आसानी से करता है।
Step by step
TradingView खोलें
उस asset के chart पर जाएँ जिसे आप test करना चाहते हैं (EUR/USD, BTCUSD, Volatility 75, आदि)।
Pine Editor खोलें
नीचे “Pine Editor” tab click करें। Default code delete करें।
एक strategy paste करें
नीचे ready example का उपयोग करें या AI के साथ generate करें (“create a Pine Script v5 strategy with…”)।
Chart में add करें
“Add to chart” click करें। Strategy historical data पर लागू होगी।
Strategy Tester खोलें
नीचे, “Strategy Tester” click करें। आप पूरे backtest results देखेंगे।
Ready example strategy
Backtest के लिए RSI filter के साथ EMA crossover strategy:
//@version=5
strategy("EMA Cross + RSI — IA Trader Pro", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=10, commission_type=strategy.commission.percent, commission_value=0.1)
// === PARAMETERS ===
emaFast = input.int(9, "Fast EMA")
emaSlow = input.int(21, "Slow EMA")
rsiPeriod = input.int(14, "RSI Period")
rsiBuy = input.int(40, "RSI minimum for buy")
rsiSell = input.int(60, "RSI maximum for sell")
slPercent = input.float(2.0, "Stop Loss %") / 100
tpPercent = input.float(4.0, "Take Profit %") / 100
// === INDICATORS ===
ef = ta.ema(close, emaFast)
es = ta.ema(close, emaSlow)
r = ta.rsi(close, rsiPeriod)
// === CONDITIONS ===
longCond = ta.crossover(ef, es) and r > rsiBuy and r < 70
shortCond = ta.crossunder(ef, es) and r < rsiSell and r > 30
// === EXECUTION ===
if longCond
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=close*(1-slPercent), limit=close*(1+tpPercent))
if shortCond
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop=close*(1+slPercent), limit=close*(1-tpPercent))
// === PLOT ===
plot(ef, "EMA Fast", color.green, 2)
plot(es, "EMA Slow", color.red, 2)
Results को कैसे interpret करें
| Metric | क्या मतलब है | Ideal value |
|---|---|---|
| Net Profit | Total net profit | Positive |
| Total Trades | Trades की संख्या | > 100 |
| Percent Profitable | Winning trades का % | > 50% |
| Profit Factor | Gross profit / gross loss | > 1.5 |
| Max Drawdown | सबसे बड़ा equity drop | < 20% |
| Avg Trade | प्रति trade औसत profit | Positive |
| Sharpe Ratio | Risk-adjusted return | > 1.0 |
✅ अच्छी strategy
+100 trades, +55% win rate, profit factor > 1.5, drawdown < 20%। यदि backtest में यह सभी criteria hit करती है, demo पर test करने लायक है।
❌ खराब या overfitted
< 30 trades, profit factor < 1.2, drawdown > 30%, win rate > 90% (overfit suspect)। Reject करें और refine करें।
Common mistakes
- Overfitting: Parameters को बहुत tweak करना जब तक यह अतीत में “perfect” न दिखे। आमतौर पर भविष्य में fail होती है
- Small sample: 50 से कम trades वाले Backtests reliable नहीं हैं
- Spread/commission ignore करना: Real Forex में, spread small profits खा जाता है
- केवल favorable data का उपयोग: विभिन्न periods पर test करें (uptrend, downtrend, sideways)
- Lookahead bias: Code जो “भविष्य देखता है” — खराब लिखे Pine Script में common
Tip: AI के साथ backtesting
Results analyze करने के लिए AI (ChatGPT/Claude) से पूछें। Report paste करें और पूछें:
- “Does this strategy show signs of overfitting?”
- “Which parameters could I tweak to improve the profit factor?”
- “Is X% drawdown acceptable for that win rate?”
- “Convert this strategy to a Python + Deriv API bot”
🚀 Backtest में validate करने के बाद, live Deriv demo account पर test करें:
Deriv Demo Account खोलें →