
यह रणनीति एक घातीय चलती औसत (ईएमए) आधारित ट्रेडिंग प्रणाली है जो बाजार के रुझानों में परिवर्तनों की पहचान करने के लिए मुख्य रूप से ईएमए 20 और ईएमए 50 के क्रॉसओवर का उपयोग करती है। यह रणनीति गतिशील बहु-स्तरीय लाभ बिंदुओं को डिजाइन करती है और जोखिमों को नियंत्रित करने के लिए स्टॉप-लॉस तंत्र को जोड़ती है। यह प्रणाली पृष्ठभूमि के रंग में परिवर्तन के माध्यम से बाजार के रुझान की दिशा को दृश्यात्मक रूप से प्रदर्शित करती है, जिससे व्यापारियों को बाजार के रुझान को बेहतर ढंग से समझने में मदद मिलती है।
रणनीति का मूल तर्क निम्नलिखित पहलुओं पर आधारित है:
यह एक पूर्ण संरचना और स्पष्ट तर्क के साथ एक प्रवृत्ति-अनुसरण रणनीति है। मूविंग एवरेज क्रॉसओवर के माध्यम से रुझानों को पकड़ें, गतिशील लाभ बिंदुओं का उपयोग करके रिटर्न का प्रबंधन करें, और स्टॉप-लॉस के साथ जोखिमों को नियंत्रित करें। रणनीति का दृश्य डिजाइन सहज और प्रभावी है, और पैरामीटर सेटिंग्स लचीली और समायोज्य हैं। यद्यपि चलती औसत के साथ एक अंतर्निहित विलंब समस्या है, फिर भी अनुकूलन और सुधार के माध्यम से रणनीति की स्थिरता और लाभप्रदता को और बेहतर बनाया जा सकता है।
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-04 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA Crossover Strategy with Take Profit and Candle Highlighting", overlay=true)
// Define the EMAs
ema200 = ta.ema(close, 200)
ema50 = ta.ema(close, 50)
ema20 = ta.ema(close, 20)
// Plot the EMAs
plot(ema200, color=#c204898e, title="EMA 200", linewidth=2)
plot(ema50, color=color.blue, title="EMA 50", linewidth=2)
plot(ema20, color=color.orange, title="EMA 20", linewidth=2)
// Define Buy and Sell conditions based on EMA crossover
buySignal = ta.crossover(ema20, ema50) // EMA 20 crosses above EMA 50 (Bullish)
sellSignal = ta.crossunder(ema20, ema50) // EMA 20 crosses below EMA 50 (Bearish)
// Define input values for Take Profit multipliers
tp1_multiplier = input.float(0.5, title="TP1 Multiplier", minval=0.1, maxval=5.0, step=0.1)
tp2_multiplier = input.float(1.0, title="TP2 Multiplier", minval=0.1, maxval=5.0, step=0.1)
tp3_multiplier = input.float(1.5, title="TP3 Multiplier", minval=0.1, maxval=5.0, step=0.1)
tp4_multiplier = input.float(2.0, title="TP4 Multiplier", minval=0.1, maxval=5.0, step=0.1)
// Define Take Profit Levels as float variables initialized with na
var float takeProfit1 = na
var float takeProfit2 = na
var float takeProfit3 = na
var float takeProfit4 = na
// Calculate take profit levels based on the multipliers
if buySignal
takeProfit1 := high + (high - low) * tp1_multiplier // TP1: Set TP at multiplier of previous range above the high
takeProfit2 := high + (high - low) * tp2_multiplier // TP2: Set TP at multiplier of previous range above the high
takeProfit3 := high + (high - low) * tp3_multiplier // TP3: Set TP at multiplier of previous range above the high
takeProfit4 := high + (high - low) * tp4_multiplier // TP4: Set TP at multiplier of previous range above the high
if sellSignal
takeProfit1 := low - (high - low) * tp1_multiplier // TP1: Set TP at multiplier of previous range below the low
takeProfit2 := low - (high - low) * tp2_multiplier // TP2: Set TP at multiplier of previous range below the low
takeProfit3 := low - (high - low) * tp3_multiplier // TP3: Set TP at multiplier of previous range below the low
takeProfit4 := low - (high - low) * tp4_multiplier // TP4: Set TP at multiplier of previous range below the low
// Plot Take Profit Levels on the chart
plot(takeProfit1, color=#b4b4b8, style=plot.style_line, linewidth=1, title="Take Profit 1")
plot(takeProfit2, color=#b4b4b8, style=plot.style_line, linewidth=1, title="Take Profit 2")
plot(takeProfit3, color=#b4b4b8, style=plot.style_line, linewidth=1, title="Take Profit 3")
plot(takeProfit4, color=#b4b4b8, style=plot.style_line, linewidth=1, title="Take Profit 4")
// Create buy and sell signals on the chart
plotshape(series=buySignal, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal", text="BUY")
plotshape(series=sellSignal, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal", text="SELL")
// Highlight the candles based on trend direction
uptrend = ta.crossover(ema20, ema50) // EMA 20 crosses above EMA 50 (Bullish)
downtrend = ta.crossunder(ema20, ema50) // EMA 20 crosses below EMA 50 (Bearish)
// Highlighting candles based on trend
bgcolor(color = ema20 > ema50 ? color.new(color.green, 80) : ema20 < ema50 ? color.new(color.red, 80) : na)
// Execute buy and sell orders on the chart
strategy.entry("Buy", strategy.long, when=buySignal)
strategy.entry("Sell", strategy.short, when=sellSignal)
// Exit conditions based on Take Profit levels
strategy.exit("Take Profit 1", "Buy", limit=takeProfit1)
strategy.exit("Take Profit 2", "Buy", limit=takeProfit2)
strategy.exit("Take Profit 3", "Buy", limit=takeProfit3)
strategy.exit("Take Profit 4", "Buy", limit=takeProfit4)
strategy.exit("Take Profit 1", "Sell", limit=takeProfit1)
strategy.exit("Take Profit 2", "Sell", limit=takeProfit2)
strategy.exit("Take Profit 3", "Sell", limit=takeProfit3)
strategy.exit("Take Profit 4", "Sell", limit=takeProfit4)
// Optionally, add a stop loss
stopLoss = 0.03 // Example: 3% stop loss
strategy.exit("Stop Loss", "Buy", stop=close * (1 - stopLoss))
strategy.exit("Stop Loss", "Sell", stop=close * (1 + stopLoss))