ریورس K-لائن بریک آؤٹ قلیل مدتی تجارتی حکمت عملی


تخلیق کی تاریخ: 2023-11-21 17:03:32 آخر میں ترمیم کریں: 2023-11-21 17:03:32
کاپی: 0 کلکس کی تعداد: 555
1
پر توجہ دیں
1617
پیروکار

ریورس K-لائن بریک آؤٹ قلیل مدتی تجارتی حکمت عملی

جائزہ

اس حکمت عملی کا استعمال مختصر لائنوں میں واپسی کے تجارتی مواقع کو پکڑنے کے لئے کیا جاتا ہے۔ یہ مسلسل N روٹ K لائنوں میں اضافے کے بعد پوزیشن کو خالی کرتا ہے ، اور مسلسل M روٹ K لائنوں میں کمی کے بعد پوزیشن کو صاف کرتا ہے۔ اس کے علاوہ ، اس حکمت عملی میں وقت کی حد اور نقصان کو روکنے کی روک تھام شامل ہے۔

اصول

  1. ان پٹ پیرامیٹرز: مسلسل اضافہ K لائنوں کی تعداد N، مسلسل کمی K لائنوں کی تعداد M
  2. منطق کی وضاحت:
    • ups کے اعداد و شمار میں اضافہ K لائنوں کی تعداد، قیمت> قیمت[1] + 1 ہے، ورنہ ری سیٹ 0 ہے
    • ڈی این ایس کے اعدادوشمار کے نیچے کی لائن کی تعداد ، قیمت < قیمت[1] + 1 ہے، ورنہ ری سیٹ 0 ہے
  3. داخلہ: جب ups≥N ، خالی کریں؛ جب dns≥M ، صاف کریں
  4. آؤٹ پٹ: فکسڈ سٹاپ نقصان اسٹاپ یا مدت کا اختتام

فوائد

  1. ریورس ٹریڈنگ کے مواقع پر قبضہ کرنا ، مختصر لائن آپریشن کے لئے موزوں ہے
  2. ٹریڈنگ کے مختلف پروگراموں کے لئے لچکدار وقت کی حد مقرر کریں
  3. بلٹ ان نقصان روکنے کی تقریب، خطرے کے کنٹرول میں مدد ملتی ہے

خطرات

  1. شارٹ لائن الٹنا کامیاب نہیں ہو سکتا، دوبارہ الٹنا نقصان کا باعث بن سکتا ہے
  2. پیرامیٹرز N، M کو مناسب طریقے سے ترتیب دینے کی ضرورت ہے، نہ ہی بہت بڑا اور نہ ہی بہت چھوٹا
  3. غلط وقت پر روکنے کی ترتیب ممکن ہے کہ نقصان کو وقت پر روکنے میں ناکام رہے

اصلاح کی سمت

  1. رجحان کے اشارے کے ساتھ مل کر مخالف آپریشن سے بچیں
  2. متحرک ایڈجسٹمنٹ پیرامیٹرز
  3. نقصان کی روک تھام کو بہتر بنانا

خلاصہ کریں۔

اس حکمت عملی میں مختصر لائنوں کے مواقع کو پکڑنے کے لئے K لائن فارمیٹس کی شماریات کا استعمال کیا گیا ہے۔ معقول پیرامیٹرز کا تعین کرنا اور ہوا کے کنٹرول کے اقدامات مستحکم آمدنی حاصل کرنے کے لئے ضروری ہیں۔ رجحان کے فیصلے اور متحرک ایڈجسٹمنٹ پیرامیٹرز کے ساتھ مزید مجموعہ کے ذریعہ بہتر نتائج کی توقع کی جاسکتی ہے۔

حکمت عملی کا ماخذ کوڈ
/*backtest
start: 2023-11-13 00:00:00
end: 2023-11-20 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4

// Strategy
strategy("Up/Down Short Strategy", overlay=true, initial_capital = 10000, default_qty_value = 10000, default_qty_type = strategy.cash)

// There will be no short entries, only exits from long.
strategy.risk.allow_entry_in(strategy.direction.short)

consecutiveBarsUp = input(1, title='Consecutive Bars Up')
consecutiveBarsDown = input(1, title='Consecutive Bars Down')

price = close

ups = 0.0
ups := price > price[1] ? nz(ups[1]) + 1 : 0

dns = 0.0
dns := price < price[1] ? nz(dns[1]) + 1 : 0

// Strategy Backtesting
startDate  = input(timestamp("2021-01-01T00:00:00"), type = input.time, title='Backtesting Start Date')
finishDate = input(timestamp("2021-12-31T00:00:00"), type = input.time, title='Backtesting End Date')

time_cond  = true

//Time Restriction Settings
startendtime = input("", title='Time Frame To Enter Trades')
enableclose = input(false, title='Enable Close Trade At End Of Time Frame')
timetobuy = (time(timeframe.period, startendtime))
timetoclose = na(time(timeframe.period, startendtime))

// Stop Loss & Take Profit Tick Based
enablesltp = input(false, title='Enable Take Profit & Stop Loss')
stopTick = input(5.0, title='Stop Loss Ticks', type=input.float) / 100
takeTick = input(10.0, title='Take Profit Ticks', type=input.float) / 100

longStop = strategy.position_avg_price - stopTick
shortStop = strategy.position_avg_price + stopTick
shortTake = strategy.position_avg_price - takeTick
longTake = strategy.position_avg_price + takeTick

plot(strategy.position_size > 0 and enablesltp ? longStop : na, style=plot.style_linebr, color=color.red, linewidth=1, title="Long Fixed SL")
plot(strategy.position_size < 0 and enablesltp ? shortStop : na, style=plot.style_linebr, color=color.red, linewidth=1, title="Short Fixed SL")
plot(strategy.position_size > 0 and enablesltp ? longTake : na, style=plot.style_linebr, color=color.green, linewidth=1, title="Long Take Profit")
plot(strategy.position_size < 0 and enablesltp ? shortTake : na, style=plot.style_linebr, color=color.green, linewidth=1, title="Short Take Profit")

// Alert messages
message_enterlong  = input("", title="Long Entry message")
message_entershort = input("", title="Short Entry message")
message_closelong = input("", title="Close Long message")
message_closeshort = input("", title="Close Short message")
message_takeprofit = input("", title="Take Profit message")
message_stoploss = input("", title="Stop Loss message")

// Strategy Execution
if (ups >= consecutiveBarsUp) and time_cond and timetobuy
    strategy.entry("Long", strategy.long, stop = high + syminfo.mintick, alert_message = message_enterlong)
    
if (dns >= consecutiveBarsDown) and time_cond and timetobuy
    strategy.entry("Short", strategy.short, stop = low + syminfo.mintick, alert_message = message_entershort)
    
if strategy.position_size > 0 and timetoclose and enableclose
    strategy.close_all(alert_message = message_closelong)
if strategy.position_size < 0 and timetoclose and enableclose
    strategy.close_all(alert_message = message_closeshort)
    
if strategy.position_size > 0 and enablesltp and time_cond
    strategy.exit(id="Close Long", stop=longStop, limit=longTake, alert_message = message_takeprofit)
if strategy.position_size < 0 and enablesltp and time_cond
    strategy.exit(id="Close Short", stop=shortStop, limit=shortTake, alert_message = message_stoploss)