
یہ حکمت عملی ایک متحرک سپورٹ لیول ٹریڈنگ سسٹم ہے جو دوہری ٹائم فریم پر مبنی ہے اور تجارت کو ایس ایم اے اور ای ایم اے کی مساوی لائنوں کے کراس سگنل کے ساتھ گھڑی اور دن کے وقت کے فریموں پر تجارت کرتا ہے۔ نظام مارکیٹ کے رجحانات اور تجارت کے مواقع کی نشاندہی کرنے کے لئے مساوی لائنوں کے درمیان تشکیل دی جانے والی سپورٹ کا استعمال کرتا ہے ، اور دو مختلف ٹائم پیریڈ کے سگنل کی تصدیق کے ذریعے تجارت کی درستگی کو بہتر بناتا ہے۔ حکمت عملی فیصد پوزیشن مینجمنٹ کے طریقہ کار کو اپناتی ہے ، اور اس میں تجارتی لاگت اور اسکیلپنگ عوامل کو مدنظر رکھا جاتا ہے۔
اس حکمت عملی کا بنیادی اصول دو ٹائم پیریڈ میں میڈین لائن کے کراس اور پوزیشن کے تعلقات کی نگرانی کرکے تجارتی سگنل کا تعین کرنا ہے:
یہ حکمت عملی مختلف وقت کے ادوار کے مساوی لائن کراس سگنل کے ساتھ مل کر ایک نسبتا stable مستحکم تجارتی نظام کی تعمیر کرتی ہے۔ مارکیٹ کے رجحانات کی نشاندہی کرنے کے لئے بیئرنگ بینڈ کے تصور کا استعمال کرتے ہوئے ، متعدد تصدیق کے میکانزم کا استعمال کرتے ہوئے تجارت کی درستگی کو بہتر بناتا ہے۔ حکمت عملی کے ڈیزائن میں اصل تجارت میں مختلف عوامل کو مدنظر رکھا گیا ہے ، بشمول تجارت کی لاگت ، سلیپ پوائنٹس اور وقت کے انتظام وغیرہ۔ اگرچہ اس میں کچھ موروثی خطرات موجود ہیں ، لیکن بہتر سمت کی فراہمی سے حکمت عملی کی استحکام اور منافع میں مزید اضافہ کیا جاسکتا ہے۔
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-04 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Demo GPT - Bull Market Support Band", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_value=0.1, slippage=3)
start_date = input(timestamp("2018-01-01 00:00 +0000"), title="Start Date")
end_date = input(timestamp("2069-12-31 00:00 +0000"), title="End Date")
lsmaLength = input.int(20, title="Long SMA Length", minval=1)
lemaLength = input.int(21, title="Long EMA Length", minval=1)
customLongTimeframe = input.timeframe("W", title="Long Timeframe") // Khung thời gian dài
ssmaLength = input.int(50, title="Short SMA Length", minval=1)
semaLength = input.int(51, title="Short EMA Length", minval=1)
customShortTimeframe = input.timeframe("D", title="Short Timeframe") // Khung thời gian ngắn
source = close
// Tính toán SMA và EMA cho khung thời gian dài
smaLong = ta.sma(source, lsmaLength)
emaLong = ta.ema(source, lemaLength)
outSmaLong = request.security(syminfo.tickerid, customLongTimeframe, smaLong)
outEmaLong = request.security(syminfo.tickerid, customLongTimeframe, emaLong)
// Tính toán SMA và EMA cho khung thời gian ngắn
smaShort = ta.sma(source, ssmaLength)
emaShort = ta.ema(source, semaLength)
outSmaShort = request.security(syminfo.tickerid, customShortTimeframe, smaShort)
outEmaShort = request.security(syminfo.tickerid, customShortTimeframe, emaShort)
// Plot các chỉ báo trên biểu đồ
smaPlotLong = plot(outSmaLong, color=color.new(color.red, 0), title='20w SMA (Long)')
emaPlotLong = plot(outEmaLong, color=color.new(color.green, 0), title='21w EMA (Long)')
smaPlotShort = plot(outSmaShort, color=color.new(color.red, 0), title='20d SMA (Short)')
emaPlotShort = plot(outEmaShort, color=color.new(color.green, 0), title='21d EMA (Short)')
// Fill vùng giữa các đường SMA và EMA
fill(smaPlotLong, emaPlotLong, color=color.new(color.orange, 75), fillgaps=true)
fill(smaPlotShort, emaPlotShort, color=color.new(color.orange, 75), fillgaps=true)
// Điều kiện long và short cho khung thời gian dài
longConditionLong = ta.crossover(outEmaLong, outSmaLong)
shortConditionLong = ta.crossunder(outEmaLong, outSmaLong)
// Điều kiện long và short cho khung thời gian ngắn
longConditionShort = ta.crossover(outEmaShort, outSmaShort) and (outEmaShort > outEmaLong)
shortConditionShort = ta.crossunder(outEmaShort, outSmaShort) and (outEmaShort > outEmaLong) // Điều kiện short khi EMA ngắn hạn cắt xuống dưới SMA ngắn hạn và EMA ngắn hạn cao hơn EMA dài hạn
// Kiểm tra điều kiện trong khoảng thời gian được chỉ định
inDateRange = true
// Nếu khung ngắn hạn xuất hiện tín hiệu short, ưu tiên đóng tất cả các lệnh Long
if shortConditionShort and inDateRange
strategy.close_all()
// Nếu khung dài có tín hiệu short, đóng tất cả các lệnh Long
if shortConditionLong and inDateRange
strategy.close_all()
// Nếu khung ngắn hạn có tín hiệu long và không có tín hiệu short từ khung dài, vào lệnh Long
if longConditionShort and not shortConditionLong and not shortConditionShort and inDateRange
strategy.entry("Long", strategy.long)
// Đóng tất cả các lệnh khi không trong khoảng thời gian được chọn
if not inDateRange
strategy.close_all()