
یہ حکمت عملی ایک رجحان ٹریکنگ سسٹم ہے جس میں متعدد تکنیکی اشارے شامل ہیں ، اور تین کلاسیکی اشارے ، برن بینڈ ، آر ایس آئی اور ایم اے سی ڈی کے ساتھ مل کر کام کرتے ہیں ، تاکہ مارکیٹ میں اتار چڑھاؤ اور رجحان کی تبدیلی کے دوران تجارتی مواقع پر قبضہ کیا جاسکے۔ یہ حکمت عملی ایک پرامڈائزنگ پوزیشننگ کا استعمال کرتی ہے ، جس میں سخت تجارتی وقفہ کنٹرول کے ذریعہ خطرے کا انتظام کیا جاتا ہے۔
حکمت عملی کی بنیادی منطق تین سگنل کی تصدیق پر مبنی ہے:
یہ حکمت عملی متعدد تکنیکی اشارے کے ہم آہنگی سے کام کرتی ہے ، خطرے پر قابو پانے کے ساتھ ساتھ مستحکم منافع کی تلاش کرتی ہے۔ اگرچہ کچھ پسماندگی موجود ہے ، لیکن معقول پیرامیٹرز کی اصلاح اور رسک مینجمنٹ میکانزم کے ذریعہ ، حکمت عملی نے بہتر موافقت اور استحکام کا مظاہرہ کیا ہے۔ مستقبل میں ، اسٹریٹجی کی کارکردگی کو مزید بہتر بنانے کے لئے خودکشی کے میکانزم اور بہتر پوزیشن مینجمنٹ متعارف کرانے کے قابل ہوسکتا ہے۔
/*backtest
start: 2024-10-01 00:00:00
end: 2024-10-31 23:59:59
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("[ETH] Optimized Trend Strategy", shorttitle="Lorenzo-SuperScalping", overlay=true, pyramiding=3, initial_capital=100000, currency=currency.USD)
// === Input Parameters === //
trade_size = input.float(1.0, title="Trade Size (ETH)")
rsi_length = input.int(14, minval=1, title="RSI Length")
bb_length = input.int(20, minval=1, title="Bollinger Bands Length")
bb_mult = input.float(2.0, title="Bollinger Bands Multiplier")
macd_fast = input.int(12, minval=1, title="MACD Fast Length")
macd_slow = input.int(26, minval=1, title="MACD Slow Length")
macd_signal = input.int(9, minval=1, title="MACD Signal Length")
// === Indicators === //
// RSI
rsi = ta.rsi(close, rsi_length)
// Bollinger Bands
basis = ta.sma(close, bb_length)
dev = ta.stdev(close, bb_length) * bb_mult
upper_band = basis + dev
lower_band = basis - dev
plot(basis, color=color.blue, title="BB Basis")
plot(upper_band, color=color.red, title="BB Upper")
plot(lower_band, color=color.green, title="BB Lower")
// MACD
[macd_line, signal_line, _] = ta.macd(close, macd_fast, macd_slow, macd_signal)
macd_cross_up = ta.crossover(macd_line, signal_line)
macd_cross_down = ta.crossunder(macd_line, signal_line)
// === Signal Control Variables === //
var bool last_signal_buy = na
var int last_trade_bar = na
// === Buy Signal Condition === //
// - RSI below 45
// - Price near or below the lower Bollinger Band
// - MACD crossover
buy_signal = (rsi < 45 and close < lower_band * 1.02 and macd_cross_up)
// === Sell Signal Condition === //
// - RSI above 55
// - Price near or above the upper Bollinger Band
// - MACD crossunder
sell_signal = (rsi > 55 and close > upper_band * 0.98 and macd_cross_down)
// Ensure enough bars between trades
min_bars_between_trades = input.int(15, title="Minimum Bars Between Trades")
time_elapsed = na(last_trade_bar) or (bar_index - last_trade_bar) >= min_bars_between_trades
// === Execute Trades with Conditions === //
can_buy = buy_signal and (na(last_signal_buy) or not last_signal_buy) and time_elapsed
can_sell = sell_signal and (not na(last_signal_buy) and last_signal_buy) and time_elapsed
if (can_buy)
// Close any existing short position before opening a long
if strategy.position_size < 0
strategy.close("Short")
strategy.entry("Long", strategy.long, qty=trade_size)
last_signal_buy := true
last_trade_bar := bar_index
if (can_sell)
// Close any existing long position and open a short position
if strategy.position_size > 0
strategy.close("Long")
strategy.entry("Short", strategy.short, qty=trade_size)
last_signal_buy := false
last_trade_bar := bar_index
// === Plot Buy and Sell Signals === //
plotshape(series=can_buy, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=can_sell, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// === RSI Levels for Visualization === //
hline(45, "RSI Buy Level", color=color.green, linewidth=1, linestyle=hline.style_dotted)
hline(55, "RSI Sell Level", color=color.red, linewidth=1, linestyle=hline.style_dotted)
// Plot the RSI for reference
plot(rsi, title="RSI", color=color.purple)