
यह कई तकनीकी संकेतकों और जोखिम प्रबंधन पर आधारित एक प्रवृत्ति ट्रैकिंग रणनीति है। यह रणनीति बाजार की प्रवृत्ति की पहचान करने के लिए कई तकनीकी संकेतकों जैसे कि चलती औसत, अपेक्षाकृत मजबूत संकेतकों (आरएसआई) और गतिशील संकेतकों (डीएमआई) का उपयोग करती है, और गतिशील स्टॉप लॉस, स्थिति प्रबंधन और मासिक अधिकतम निकासी सीमा जैसे जोखिम नियंत्रण साधनों के माध्यम से धन की सुरक्षा करती है। रणनीति का मूल यह है कि प्रवृत्ति की प्रभावशीलता की पुष्टि करने के लिए बहुआयामी तकनीकी संकेतकों का उपयोग किया जाए, जबकि जोखिम को सख्ती से नियंत्रित किया जाए।
इस रणनीति में कई स्तरों पर प्रवृत्ति की पुष्टि करने के लिए तंत्र का उपयोग किया गया हैः
रणनीति एक बहुआयामी तकनीकी संकेतकों के एकीकृत उपयोग के माध्यम से एक अपेक्षाकृत पूर्ण प्रवृत्ति ट्रैकिंग ट्रेडिंग प्रणाली का निर्माण करती है। रणनीति की ताकत इसकी व्यापक जोखिम प्रबंधन ढांचे में निहित है, जिसमें गतिशील स्टॉप-लॉस, स्थिति प्रबंधन और वापसी नियंत्रण शामिल हैं। हालांकि कुछ पिछड़े जोखिम हैं, लेकिन अनुकूलन और सुधार के माध्यम से, रणनीति को विभिन्न बाजार स्थितियों में स्थिर प्रदर्शन बनाए रखने की उम्मीद है। कुंजी यह है कि रणनीति के मुख्य तर्क को बनाए रखते हुए, बाजार की स्थिति के लिए अपनी अनुकूलन क्षमता को बढ़ाया जाए।
/*backtest
start: 2024-02-10 00:00:00
end: 2025-02-08 08:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("High Win-Rate Crypto Strategy with Drawdown Limit", overlay=true, initial_capital=10000, default_qty_type=strategy.fixed, process_orders_on_close=true)
// Moving Averages
ema8 = ta.ema(close, 8)
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
// RSI settings
rsi = ta.rsi(close, 14)
rsi_ma = ta.sma(rsi, 5)
// Momentum and Volume
mom = ta.mom(close, 8)
vol_ma = ta.sma(volume, 15)
high_vol = volume > vol_ma * 1
// Trend Strength
[diplus, diminus, _] = ta.dmi(14, 14)
strong_trend = diplus > 20 or diminus > 20
// Price channels
highest_15 = ta.highest(high, 15)
lowest_15 = ta.lowest(low, 15)
mid_channel = (highest_15 + lowest_15) / 2
// Trend Conditions
uptrend = ema8 > ema21 and close > mid_channel
downtrend = ema8 < ema21 and close < mid_channel
// Entry Conditions
longCondition = uptrend and ta.crossover(ema8, ema21) and rsi_ma > 35 and rsi_ma < 65 and mom > 0 and high_vol and diplus > diminus
shortCondition = downtrend and ta.crossunder(ema8, ema21) and rsi_ma > 35 and rsi_ma < 65 and mom < 0 and high_vol and diminus > diplus
// Dynamic Stop Loss based on ATR
atr = ta.atr(14)
stopSize = atr * 1.3
// Calculate position size based on fixed risk
riskAmount = strategy.initial_capital * 0.05
getLongPosSize(riskAmount, stopSize) => riskAmount / stopSize
getShortPosSize(riskAmount, stopSize) => riskAmount / stopSize
// Monthly drawdown tracking
var float peakEquity = na
var int currentMonth = na
var float monthlyDrawdown = na
maxDrawdownPercent = 10
// Variables for SL and TP
var float stopLoss = na
var float takeProfit = na
var bool inTrade = false
var string tradeType = na
// Reset monthly metrics
monthNow = month(time)
if na(currentMonth) or currentMonth != monthNow
currentMonth := monthNow
peakEquity := strategy.equity
monthlyDrawdown := 0.0
// Update drawdown metrics
peakEquity := math.max(peakEquity, strategy.equity)
monthlyDrawdown := math.max(monthlyDrawdown, (peakEquity - strategy.equity) / peakEquity * 100)
// Trading condition
canTrade = monthlyDrawdown < maxDrawdownPercent
// Entry and Exit Logic
if strategy.position_size == 0
inTrade := false
if longCondition and canTrade
stopLoss := low - stopSize
takeProfit := close + (stopSize * 2)
posSize = getLongPosSize(riskAmount, stopSize)
strategy.entry("Long", strategy.long, qty=posSize)
strategy.exit("Long Exit", "Long", stop=stopLoss, limit=takeProfit)
inTrade := true
tradeType := "long"
if shortCondition and canTrade
stopLoss := high + stopSize
takeProfit := close - (stopSize * 2)
posSize = getShortPosSize(riskAmount, stopSize)
strategy.entry("Short", strategy.short, qty=posSize)
strategy.exit("Short Exit", "Short", stop=stopLoss, limit=takeProfit)
inTrade := true
tradeType := "short"
// Plot variables
plotSL = inTrade ? stopLoss : na
plotTP = inTrade ? takeProfit : na
// EMA Plots
plot(ema8, "EMA 8", color=color.blue, linewidth=1)
plot(ema21, "EMA 21", color=color.yellow, linewidth=1)
plot(ema50, "EMA 50", color=color.white, linewidth=1)
// SL and TP Plots
plot(plotSL, "Stop Loss", color=color.red, style=plot.style_linebr, linewidth=1)
plot(plotTP, "Take Profit", color=color.green, style=plot.style_linebr, linewidth=1)
// Signal Plots
plotshape(longCondition and canTrade, "Buy Signal", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(shortCondition and canTrade, "Sell Signal", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// SL/TP Markers with correct y parameter syntax
plot(inTrade ? stopLoss : na, "Stop Loss Level", style=plot.style_circles, color=color.red, linewidth=2)
plot(inTrade ? takeProfit : na, "Take Profit Level", style=plot.style_circles, color=color.green, linewidth=2)
// Background Color
noTradingMonth = monthlyDrawdown >= maxDrawdownPercent
bgcolor(noTradingMonth ? color.new(color.gray, 80) : uptrend ? color.new(color.green, 95) : downtrend ? color.new(color.red, 95) : na)
// Drawdown Label
var label drawdownLabel = na
label.delete(drawdownLabel)
drawdownLabel := label.new(bar_index, high, "Monthly Drawdown: " + str.tostring(monthlyDrawdown, "#.##") + "%\n" + (noTradingMonth ? "NO TRADING" : "TRADING ALLOWED"), style=label.style_label_down, color=noTradingMonth ? color.red : color.green, textcolor=color.white, size=size.small)