
ڈبل مساوی لائن کراس رجحان ٹریکنگ حکمت عملی ایک مقداری تجارتی نظام ہے جو تکنیکی تجزیہ اور جامع رسک مینجمنٹ کو جوڑتا ہے۔ اس حکمت عملی کا بنیادی حصہ مارکیٹ کے رجحان میں تبدیلی کی نشاندہی کرنے کے لئے فاسٹ سادہ حرکت پذیر اوسط ((فاسٹ ایس ایم اے) اور سست سادہ حرکت پذیر اوسط ((سست ایس ایم اے) کے کراس سگنل کا استعمال کرتا ہے ، اور متعدد رسک کنٹرول میکانزم کے ذریعہ فنڈز کی حفاظت کو یقینی بناتا ہے۔ حکمت عملی کو پائن اسکرپٹ پلیٹ فارم پر لاگو کیا گیا ہے ، جو تجارت کی متعدد اقسام کے لئے رجحانات کو ٹریک کرنے کے لئے موزوں ہے۔
یہ حکمت عملی تجارت کے فیصلوں کو دو سادہ منتقل اوسط کے مابین باہمی تعامل پر مبنی کرتی ہے۔
سگنل جنریٹنگ میکانزم:
ٹائم کنٹرول: حکمت عملی K لائن کے اختتام پر تمام تجارتی فیصلوں پر عملدرآمد کرتی ہے ، جس سے نظر آنے والے تعصب سے بچا جاتا ہے ، تاکہ پیمائش کے نتائج کی وشوسنییتا اور صداقت کو یقینی بنایا جاسکے۔
فنڈز کا انتظام:
ملٹی لیول رسک کنٹرول:
اس حکمت عملی میں ٹریڈنگ کی حفاظت اور استحکام کو یقینی بنانے کے لئے خطرے کے انتظام کے جامع اقدامات کا استعمال کرتے ہوئے رجحانات کو پکڑنے کے لئے ایک ہی لائن کراسنگ کا استعمال کیا گیا ہے۔
مضبوط رجحانات کا پتہ لگانے کا نظام:
فنڈز کا درست انتظام:
خطرے سے بچاؤ کی متعدد سطحیں:
ٹرانزیکشن پر عملدرآمد کا وقت کنٹرول:
process_orders_on_close=trueپیرامیٹرز کو یقینی بنانا کہ آرڈر کی پروسیسنگ حقیقی ٹرانزیکشن ماحول کے مطابق ہےخود کار طریقے سے ٹریکنگ اور نقصان کا نظام:
رجحانات کی نشاندہی:
فکسڈ پیرامیٹرز کے ساتھ مطابقت پذیری کے مسائل:
سٹاپ نقصان کی سرگرمی کا ٹریک:
فنڈ مینجمنٹ کے خطرات:
ٹیکنالوجی کی حدود:
سگنل جنریشن میکانزم کو بہتر بنانا:
خطرے کے انتظام کے نظام میں بہتری:
داخلہ کی اصلاح:
آراء اور تشخیصی فریم ورک:
ٹیکنالوجی میں بہتری:
ڈبل مساوی کراس رجحان ٹریکنگ حکمت عملی ایک مکمل تجارتی نظام ہے جو کلاسیکی تکنیکی تجزیہ کے طریقوں کو جدید رسک مینجمنٹ تصورات کے ساتھ جوڑتا ہے۔ اس کی بنیادی خوبی یہ ہے کہ اس میں سادہ اور واضح رجحان کی شناخت کا طریقہ کار ہے اور اس میں ایک کثیر سطح کا رسک کنٹرول سسٹم ہے۔ خاص طور پر اس کے نفیس فنڈ مینجمنٹ اور اعلی درجے کی ٹریکنگ سٹاپ نقصان کا طریقہ کار حکمت عملی کو بہتر رسک ایڈجسٹمنٹ کی واپسی کی صلاحیت فراہم کرتا ہے۔
تاہم ، اس حکمت عملی کو بھی چیلنجوں کا سامنا کرنا پڑتا ہے ، جیسے کہ حرکت پذیر اوسط کی موروثی پسماندگی اور پیرامیٹرز کی موافقت۔ اس حکمت عملی کی کارکردگی کو مزید بہتر بنانے کے لئے امید ہے کہ اس میں موافقت پذیر پیرامیٹرز ، سگنل فلٹرنگ کے طریقہ کار کو بڑھانا اور خطرے کے انتظام کے نظام کو بہتر بنایا جائے۔
مجموعی طور پر ، یہ ایک اچھی طرح سے تشکیل شدہ ، منطقی طور پر واضح ، مقداری حکمت عملی کا فریم ورک ہے جو درمیانی اور طویل مدتی رجحانات کی پیروی کرنے والے نظام کی بنیاد کے لئے موزوں ہے ، خاص طور پر ایسی منڈیوں کے لئے جو واضح رجحانات کی خصوصیات رکھتی ہیں۔ تاجروں کے لئے ، اس کے خطرے کے انتظام کے نظریات کو سمجھنا اور ان پر قابو پانا اس حکمت عملی کا سب سے قیمتی حصہ ہے جو سادہ نقل کی حکمت عملی کے پیرامیٹرز سے کہیں زیادہ اہم ہے۔
/*backtest
start: 2025-06-04 00:00:00
end: 2025-06-11 00:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title="Dual SMA Crossover Strategy", overlay=true, calc_on_every_tick=false, process_orders_on_close=true)
// --- Inputs ---
// SMA Lengths
fast_length = input.int(24, title="Fast SMA Length", minval=1)
slow_length = input.int(48, title="Slow SMA Length", minval=1)
// Risk Management
risk_per_trade_percent = input.float(2.0, title="Risk Per Trade (%)", minval=0.1, maxval=10.0, step=0.1) // % of equity to risk per trade
stop_loss_percent = input.float(0.8, title="Stop Loss (%)", minval=0.1, step=0.1) // % from entry price
risk_reward_ratio = input.float(2.0, title="Risk-Reward Ratio", minval=0.5, step=0.1) // 2.0 = 2R, 3.0 = 3R etc.
// Advanced Trailing Stop Loss
trailing_start_percent = input.float(1.0, title="Trailing Stop Start (%)", minval=0.1, step=0.1) // % profit to activate TSL
trailing_stop_percent = input.float(0.5, title="Trailing Stop Trail (%)", minval=0.1, step=0.1) // % to trail by once activated
// --- Calculations ---
// Calculate SMAs
fast_sma = ta.sma(close, fast_length)
slow_sma = ta.sma(close, slow_length)
// Plot SMAs on chart
plot(fast_sma, color=color.blue, title="Fast SMA")
plot(slow_sma, color=color.red, title="Slow SMA")
// Crossover conditions (calculated on previous bar to prevent look-ahead bias)
long_condition = ta.crossover(fast_sma[1], slow_sma[1])
short_condition = ta.crossunder(fast_sma[1], slow_sma[1])
// --- Money Management and Position Sizing ---
// Calculate account equity and risk amount
account_equity = strategy.initial_capital + strategy.netprofit
risk_amount = account_equity * (risk_per_trade_percent / 100)
// Calculate Stop Loss price based on entry and SL percentage
var float long_stop_price = na
var float short_stop_price = na
var float long_take_profit_price = na
var float short_take_profit_price = na
// --- Trailing Stop Loss Variables ---
var float trailing_long_activated_price = na // Price at which TSL is activated for long
var float trailing_short_activated_price = na // Price at which TSL is activated for short
var float current_trailing_stop_long = na
var float current_trailing_stop_short = na
var bool is_long_trailing_active = false
var bool is_short_trailing_active = false
// --- Strategy Entry and Exit Orders ---
if long_condition
// Reset TSL variables for a new entry
trailing_long_activated_price := na
current_trailing_stop_long := na
is_long_trailing_active := false
// Calculate SL, TP for long entry
long_stop_price := close * (1 - stop_loss_percent / 100) // SL below entry
long_take_profit_price := close * (1 + (stop_loss_percent * risk_reward_ratio) / 100) // TP above entry based on RRR
// Calculate position size for long entry
price_change_per_unit = close * (stop_loss_percent / 100)
if price_change_per_unit > 0
long_quantity = risk_amount / price_change_per_unit
strategy.entry("Long", strategy.long, qty=long_quantity, comment="Buy Signal")
else
strategy.entry("Long", strategy.long, comment="Buy Signal (Risk calculation skipped)") // Fallback if SL is 0 or negative
if short_condition
// Reset TSL variables for a new entry
trailing_short_activated_price := na
current_trailing_stop_short := na
is_short_trailing_active := false
// Calculate SL, TP for short entry
short_stop_price := close * (1 + stop_loss_percent / 100) // SL above entry
short_take_profit_price := close * (1 - (stop_loss_percent * risk_reward_ratio) / 100) // TP below entry based on RRR
// Calculate position size for short entry
price_change_per_unit = close * (stop_loss_percent / 100)
if price_change_per_unit > 0
short_quantity = risk_amount / price_change_per_unit
strategy.entry("Short", strategy.short, qty=short_quantity, comment="Sell Signal")
else
strategy.entry("Short", strategy.short, comment="Sell Signal (Risk calculation skipped)") // Fallback if SL is 0 or negative
// --- Stop Loss, Take Profit, Trailing Stop Logic ---
// Long position management
if strategy.position_size > 0 // We are in a long position
entry_price = strategy.opentrades.entry_price(0)
current_profit_percent = ((close - entry_price) / entry_price) * 100
// Initial SL and TP set at entry
strategy.exit("Exit Long", from_entry="Long", stop=long_stop_price, limit=long_take_profit_price, comment="TP/SL Long")
// Check for Trailing Stop activation
if not is_long_trailing_active and current_profit_percent >= trailing_start_percent
is_long_trailing_active := true
// Set initial trailing stop when activated
trailing_long_activated_price := high // Or close, depending on preference
current_trailing_stop_long := high * (1 - trailing_stop_percent / 100)
// If trailing stop is active, update it
if is_long_trailing_active
// Only move the trailing stop up (for long positions)
potential_new_stop = high * (1 - trailing_stop_percent / 100)
current_trailing_stop_long := math.max(current_trailing_stop_long, potential_new_stop)
// Ensure trailing stop is not below the initial long_stop_price
// This prevents the trailing stop from being less protective than the initial SL if the price drops after activation.
current_trailing_stop_long := math.max(current_trailing_stop_long, long_stop_price)
strategy.exit("Trailing Exit Long", from_entry="Long", stop=current_trailing_stop_long, comment="Trailing SL Long")
// Short position management
if strategy.position_size < 0 // We are in a short position
entry_price = strategy.opentrades.entry_price(0)
current_profit_percent = ((entry_price - close) / entry_price) * 100
// Initial SL and TP set at entry
strategy.exit("Exit Short", from_entry="Short", stop=short_stop_price, limit=short_take_profit_price, comment="TP/SL Short")
// Check for Trailing Stop activation
if not is_short_trailing_active and current_profit_percent >= trailing_start_percent
is_short_trailing_active := true
// Set initial trailing stop when activated
trailing_short_activated_price := low // Or close, depending on preference
current_trailing_stop_short := low * (1 + trailing_stop_percent / 100)
// If trailing stop is active, update it
if is_short_trailing_active
// Only move the trailing stop down (for short positions)
potential_new_stop = low * (1 + trailing_stop_percent / 100)
current_trailing_stop_short := math.min(current_trailing_stop_short, potential_new_stop)
// Ensure trailing stop is not above the initial short_stop_price
current_trailing_stop_short := math.min(current_trailing_stop_short, short_stop_price)
strategy.exit("Trailing Exit Short", from_entry="Short", stop=current_trailing_stop_short, comment="Trailing SL Short")
// Plot background color to indicate active position (optional)
bgcolor(strategy.position_size > 0 ? color.new(color.green, 90) : na, title="Long Position Background")
bgcolor(strategy.position_size < 0 ? color.new(color.red, 90) : na, title="Short Position Background")