Qullamaggie فرار کی نگرانی کی حکمت عملی

مصنف:چاؤ ژانگ، تاریخ: 2024-01-31 17:06:36
ٹیگز:

img

جائزہ

اس حکمت عملی کا بنیادی خیال ایک بڑے ٹائم فریم پر رجحان کی سمت کی نشاندہی کرنا اور چھوٹے ٹائم فریم پر داخل ہونے کے لئے بریک آؤٹ پوائنٹس تلاش کرنا ہے۔ اسٹاپ نقصان سے باہر نکلنے کے بعد بڑے ٹائم فریم پر چلتی اوسط کو ٹریک کرتا ہے۔

حکمت عملی کا اصول

یہ حکمت عملی بنیادی طور پر فیصلے کے لیے تین اشارے پر مبنی ہے۔

سب سے پہلے ، ایک طویل سائیکل (جیسے روزانہ) ایکس ڈے سادہ چلتی اوسط کا حساب لگائیں۔ صرف اس وقت خریدنے کی اجازت دیں جب قیمت اس چلتی اوسط سے اوپر ہو۔ اس کا استعمال مجموعی رجحان کی سمت کا تعین کرنے اور تجارتی جھولنے والے ادوار سے بچنے کے لئے کیا جاسکتا ہے۔

دوسرا ، کم سے کم سائیکل (جیسے 5 دن) میں سب سے زیادہ قیمت سوئنگ ہائی کا حساب لگائیں۔ جب قیمت اس سب سے زیادہ قیمت کو توڑتی ہے تو ، خریدنے کا سگنل ٹرگر ہوجاتا ہے۔ مناسب بریک آؤٹ پوائنٹس تلاش کرنے کے لئے یہاں ایل بی بیک بیک پیریڈ پیرامیٹر کا استعمال کیا جاتا ہے۔

تیسرا ، اسٹاپ نقصان لائن قائم کریں۔ پوزیشن میں داخل ہونے کے بعد ، اسٹاپ نقصان لائن کو کم سے کم قیمت پر ایک خاص مدت کے لئے بند کردیا جاتا ہے۔ اسی وقت ، ایک حرکت پذیر اوسط لائن (جیسے روزانہ پر 10 دن کا ای ایم اے) کو باہر نکلنے کے طریقہ کار کے طور پر مقرر کریں۔ جب قیمت اس حرکت پذیر اوسط لائن سے نیچے ہو تو پوزیشن سے باہر نکلیں۔

اسٹریٹجی میں اوور اسٹینڈنگ پوائنٹس خریدنے سے بچنے کے لئے اے ٹی آر ویلیو بھی مقرر کیا جاتا ہے۔ بیک ٹسٹ ٹائم رینج جیسے دیگر معاون شرائط بھی ہیں۔

مذکورہ بالا تین اشارے کے باہمی تعامل کا فیصلہ اس حکمت عملی کا بنیادی منطق ہے۔

فوائد کا تجزیہ

بریک آؤٹ ٹریکنگ کی حکمت عملی کے طور پر، اس کے مندرجہ ذیل فوائد ہیں:

  1. دو ٹائم فریم استعمال کریں تاکہ اتار چڑھاؤ والے بازاروں میں جعلی بریک آؤٹ میں پھنسنے سے بچیں۔ طویل ٹائم فریم مجموعی رجحان کا تعین کرتا ہے ، اور مختصر ٹائم فریم مخصوص انٹری پوائنٹس تلاش کرتا ہے۔

  2. سوئنگ ہائی کے ذریعہ تشکیل دیئے گئے بریک آؤٹ پوائنٹس کا استعمال کریں۔ اس قسم کے بریک آؤٹ میں ایک خاص inertia ہوتی ہے اور ٹریکنگ بنانا آسان ہوتا ہے۔ واقعی موثر بریک آؤٹ تلاش کرنے کے لئے ایل بی بیک بیک پیریڈ پیرامیٹر کو بھی ایڈجسٹ کیا جاسکتا ہے۔

  3. سٹاپ نقصان کا طریقہ نسبتا سخت ہے، ایک مخصوص بفر فاصلے کے ساتھ تازہ ترین کم نقطہ نظر کو ٹریک کرنے سے بچنے کے لئے.

  4. مارکیٹ کے حالات کے مطابق منافع لینے کے لئے ایک باہر نکلنے کے طریقہ کار کے طور پر چلتی اوسط کا استعمال کریں.

  5. اے ٹی آر اشارے سے زیادہ فائدہ اٹھانے کے خطرے سے بچنے کے لئے.

  6. ٹیسٹنگ کے لئے مختلف پیرامیٹر مجموعے مقرر کیے جاسکتے ہیں ، جس میں اصلاح کی بڑی جگہ ہے۔

خطرے کا تجزیہ

اس حکمت عملی میں کچھ خطرات بھی ہیں:

  1. جب قیمت حرکت پذیر اوسط لائن کے گرد اوپر اور نیچے جھولتی ہے تو ، داخلہ اور باہر نکلنے والی پوزیشنوں کے درمیان آگے پیچھے سوئچ کرنا آسان ہے۔ کمیشن کا زیادہ خطرہ ہے۔

  2. جب توڑنے کا نقطہ حرکت پذیر اوسط لائن کے قریب ہوتا ہے تو ، نسبتا large بڑا واپسی کا خطرہ ہوتا ہے۔ یہ حکمت عملی کی ایک موروثی خصوصیت ہے۔

  3. جب مارکیٹ میں کوئی واضح رجحان نہیں ہوتا ہے تو ، انعقاد کا وقت بہت لمبا ہوسکتا ہے ، جس سے وقت کا خطرہ ہوتا ہے۔

  4. اے ٹی آر پیرامیٹر کو معقول حد تک ترتیب دینے کی ضرورت ہے۔ اگر اے ٹی آر بہت چھوٹا ہے تو فلٹرنگ اثر کمزور ہے۔ اگر یہ بہت بڑا ہے تو ، داخلے کے مواقع کم ہوجائیں گے۔

  5. نتائج پر مختلف ایل بی پیرامیٹرز کے اثرات کی جانچ کرنے کی ضرورت ہے۔ بہت زیادہ پیرامیٹرز کچھ مواقع سے محروم ہوسکتے ہیں ، جبکہ بہت کم پیرامیٹرز غلط بریک آؤٹ کی نشاندہی کرسکتے ہیں۔

خطرے کو کم کرنا:

  1. فلٹرنگ کی صلاحیت کو بڑھانے کے لئے مناسب طریقے سے چلتی اوسط پیرامیٹرز کو ایڈجسٹ کریں.
  2. اے ٹی آر پیرامیٹرز کو بہتر بنائیں، بصری فیصلے کے ساتھ مکمل کریں.
  3. مثالی پیرامیٹرز تلاش کرنے کے لئے پونڈ بیک بیک مدت کو ایڈجسٹ کریں.
  4. مارکیٹوں میں اتار چڑھاؤ کے دوران تجارت معطل کریں۔

اصلاح کی ہدایات

اسٹریٹیجی کو مندرجہ ذیل جہتوں میں بھی بہتر بنایا جاسکتا ہے:

  1. بہترین پیرامیٹرز تلاش کرنے کے لئے حرکت پذیر اوسط پیرامیٹرز کے مختلف مجموعے کی جانچ کریں۔

  2. داخل ہونے کے مواقع اور خطرے کے کنٹرول کو متوازن کرنے کے لئے مختلف ATR پیرامیٹرز کی ترتیبات کی کوشش کریں.

  3. زیادہ موثر بریکآؤٹس کی نشاندہی کرنے کے لئے پونڈ نظرثانی کی مدت پیرامیٹر کو بہتر بنائیں.

  4. خطرہ کو کنٹرول کرنے کے لئے اتار چڑھاؤ اور ڈراؤونگ پر مبنی متحرک اسٹاپ نقصان کی تعمیر کرنے کی کوشش کریں۔

  5. بریکآؤٹس کی تاثیر کا تعین کرنے کے لیے دیگر عوامل جیسے تجارتی حجم کو شامل کریں۔

  6. حوالہ جات کے طور پر انتہائی نکات تلاش کرنے کے لئے / ، < اور دیگر طریقوں کو تیار کریں۔

  7. بہترین پیرامیٹرز کے لئے پیرامیٹرز کو تربیت دینے کے لئے مشین سیکھنے کی کوشش کریں

خلاصہ

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


/*backtest
start: 2023-01-24 00:00:00
end: 2024-01-30 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © millerrh

// The intent of this strategy is to buy breakouts with a tight stop on smaller timeframes in the direction of the longer term trend.
// Then use a trailing stop of a close below either the 10 MA or 20 MA (user choice) on that larger timeframe as the position 
// moves in your favor (i.e. whenever position price rises above the MA).
// Option of using daily ATR as a measure of finding contracting ranges and ensuring a decent risk/reward.
// (If the difference between the breakout point and your stop level is below a certain % of ATR, it could possibly find those consolidating periods.)

//@version=4
strategy("Qullamaggie Breakout", overlay=true, initial_capital=10000, currency='USD', 
   default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1)
   
// === BACKTEST RANGE ===
Start = input(defval = timestamp("01 Jan 2019 06:00 +0000"), title = "Backtest Start Date", type = input.time)
Finish = input(defval = timestamp("01 Jan 2100 00:00 +0000"), title = "Backtest End Date", type = input.time)

// Inputs
lb = input(defval = 3, title = "Lookback Period for Swing High", minval = 1,
   tooltip = "Lookback period for defining the breakout level.")
lbStop = input(defval = 3, title = "Lookback Bars for Stop Level", minval = 1,
   tooltip = "Initial stop placement is the lowest low this many bars back. Allows for tighter stop placement than referencing swing lows.")  
htf = input(defval="D", title="Timeframe of Moving Averages", type=input.resolution,
  tooltip = "Allows you to set a different time frame for the moving averages. The default behavior is to identify good tightening setups on a larger timeframe
  (like daily) and enter the trade on a breakout occuring on a smaller timeframe, using the moving averages of the larger timeframe to trail your stop.")
maType = input(defval="SMA", options=["EMA", "SMA"], title = "Moving Average Type")
ma1Length = input(defval = 10, title = "1st Moving Average Length", minval = 1)
ma2Length = input(defval = 20, title = "2nd Moving Average Length", minval = 1)
ma3Length = input(defval = 50, title = "3rd Moving Average Length", minval = 1)
useMaFilter = input(title = "Use 3rd Moving Average for Filtering?", type = input.bool, defval = true,
  tooltip = "Signals will be ignored when price is under this slowest moving average.  The intent is to keep you out of bear periods and only
             buying when price is showing strength or trading with the longer term trend.")
trailMaInput = input(defval="2nd Moving Average", options=["1st Moving Average", "2nd Moving Average"], title = "Trailing Stop")

// MA Calculations
ma(maType, src, length) =>
    maType == "EMA" ? ema(src, length) : sma(src, length) //Ternary Operator (if maType equals EMA, then do ema calc, else do sma calc)
ma1 = security(syminfo.tickerid, htf, ma(maType, close, ma1Length))
ma2 = security(syminfo.tickerid, htf, ma(maType, close, ma2Length))
ma3 = security(syminfo.tickerid, htf, ma(maType, close, ma3Length))

plot(ma1, color=color.purple, style=plot.style_line, title="MA1", linewidth=2, transp = 60)
plot(ma2, color=color.yellow, style=plot.style_line, title="MA2", linewidth=2, transp = 60)
plot(ma3, color=color.white, style=plot.style_line, title="MA3", linewidth=2, transp = 60)

// === USE ATR FOR FILTERING ===
// The idea here is that you want to buy in a consolodating range for best risk/reward. So here you can compare the current distance between 
// support/resistance vs.the ATR and make sure you aren't buying at a point that is too extended from normal.
useAtrFilter = input(title = "Use ATR for Filtering?", type = input.bool, defval = false,
  tooltip = "Signals will be ignored if the distance between support and resistance is larger than a user-defined percentage of Daily ATR. 
             This allows the user to ensure they are not buying something that is too extended and instead focus on names that are consolidating more.")
atrPerc = input(defval = 100, title = "% of Daily ATR Value", minval = 1)
atrValue = security(syminfo.tickerid, "D", atr(14))*atrPerc*.01

// === PLOT SWING HIGH/LOW AND MOST RECENT LOW TO USE AS STOP LOSS EXIT POINT ===
// Change these values to adjust the look back and look forward periods for your swing high/low calculations
pvtLenL = lb
pvtLenR = lb

// Get High and Low Pivot Points
pvthi_ = pivothigh(high, pvtLenL, pvtLenR)
pvtlo_ = pivotlow(low, pvtLenL, pvtLenR)

// Force Pivot completion before plotting.
Shunt = 1 //Wait for close before printing pivot? 1 for true 0 for flase
maxLvlLen = 0 //Maximum Extension Length
pvthi = pvthi_[Shunt]
pvtlo = pvtlo_[Shunt]

// Count How many candles for current Pivot Level, If new reset.
counthi = barssince(not na(pvthi))
countlo = barssince(not na(pvtlo))
 
pvthis = fixnan(pvthi)
pvtlos = fixnan(pvtlo)
hipc = change(pvthis) != 0 ? na : color.maroon
lopc = change(pvtlos) != 0 ? na : color.green

// Display Pivot lines
plot((maxLvlLen == 0 or counthi < maxLvlLen) ? pvthis : na, color=hipc, transp=0, linewidth=1, offset=-pvtLenR-Shunt, title="Top Levels")
// plot((maxLvlLen == 0 or countlo < maxLvlLen) ? pvtlos : na, color=lopc, transp=0, linewidth=1, offset=-pvtLenR-Shunt, title="Bottom Levels")
plot((maxLvlLen == 0 or counthi < maxLvlLen) ? pvthis : na, color=hipc, transp=0, linewidth=1, offset=0, title="Top Levels 2")
// plot((maxLvlLen == 0 or countlo < maxLvlLen) ? pvtlos : na, color=lopc, transp=0, linewidth=1, offset=0, title="Bottom Levels 2")

// BUY CONDITIONS
stopLevelCalc = valuewhen(pvtlo_, low[pvtLenR], 0) //Stop Level at Swing Low
buyLevel = valuewhen(pvthi_, high[pvtLenR], 0) //Buy level at Swing High
plot(buyLevel, style=plot.style_line, color=color.blue, title = "Current Breakout Level", show_last=1, linewidth=1, transp=50, trackprice=true)

// Conditions for entry and exit
stopLevel = float(na) // Define stop level here as "na" so that I can reference it in the inPosition 
  // variable and the ATR calculation before the stopLevel is actually defined.
buyConditions = (useMaFilter ? buyLevel > ma3 : true) and
  (useAtrFilter ? (buyLevel - stopLevel[1]) < atrValue : true)
// buySignal = high > buyLevel and buyConditions
buySignal = crossover(high, buyLevel) and buyConditions
trailMa = trailMaInput == "1st Moving Average" ? ma1 : ma2
sellSignal = crossunder(close, trailMa)
// sellSignal = security(syminfo.tickerid, htf, close < trailMa) and security(syminfo.tickerid, htf, close[1] < trailMa)


// STOP AND PRICE LEVELS
inPosition = bool(na)
inPosition := buySignal[1] ? true : sellSignal[1] ? false : low <= stopLevel[1] ? false : inPosition[1]

lowDefine = lowest(low, lbStop)
stopLevel := inPosition ? stopLevel[1] : lowDefine
// plot(stopLevel)

buyPrice = buyLevel
buyPrice := inPosition ? buyPrice[1] : buyLevel
plot(stopLevel, style=plot.style_line, color=color.orange, title = "Current Stop Level", show_last=1, linewidth=1, transp=50, trackprice=true)
plot(inPosition ? stopLevel : na, style=plot.style_circles, color=color.orange, title = "Historical Stop Levels", transp=50, trackprice=false)
// plot(buyPrice, style=plot.style_line, color=color.blue, linewidth=1, transp=50, trackprice=true)

// (STRATEGY ONLY) Comment out for Study
strategy.entry("Long", strategy.long, stop = buyLevel, when = buyConditions)
strategy.exit("Exit Long", from_entry = "Long", stop=stopLevel[1])
if (low[1] > trailMa)
    strategy.close("Long", when = sellSignal)
// if (low[1] > trailMa)
//     strategy.exit("Exit Long", from_entry = "Long", stop=trailMa) //to get this to work right, I need to reference highest highs instead of swing highs
    //because it can have me buy right back in after selling if the stop level is above the last registered swing high point.

مزید