একাধিক সূচকের উপর ভিত্তি করে সিদ্ধান্ত গ্রহণের জন্য স্বল্পমেয়াদী প্রবণতা কৌশল

লেখক:চাওঝাং, তারিখ: ২০২৩-১০-২৫ ১৫ঃ৩১ঃ৩০
ট্যাগঃ

img

সারসংক্ষেপ

এই কৌশলটিতে বিভিন্ন মাত্রার তিনটি প্রযুক্তিগত সূচক অন্তর্ভুক্ত রয়েছে, যার মধ্যে রয়েছে সমর্থন/প্রতিরোধের মাত্রা, চলমান গড়ের সিস্টেম এবং দোলকের সূচক, যাতে উচ্চতর জয়ের হারের জন্য স্বল্পমেয়াদী প্রবণতার দিকনির্দেশ নির্ধারণ করা যায়।

কৌশলগত যুক্তি

কোডটি প্রথমে স্ট্যান্ডার্ড পিভট পয়েন্ট এবং ফিবোনাচি রিট্র্যাকশন স্তর সহ মূল্যের সমর্থন / প্রতিরোধের স্তরগুলি গণনা করে এবং চার্টে তাদের চার্ট করে। এই মূল স্তরগুলি ভাঙ্গার ফলে গুরুত্বপূর্ণ প্রবণতা সংকেতগুলি সংকেত দেয়।

তারপর এটি গোল্ডেন ক্রস এবং ডেথ ক্রস সিগন্যালগুলির জন্য ভলিউম ওয়েটেড এভারেজ প্রাইস (ভিডাব্লুএপি) এবং গড় মূল্য গণনা করে। এটি মাঝারি-দীর্ঘমেয়াদী প্রবণতা বিচারের অন্তর্গত।

অবশেষে, এটি ওভারকোপড এবং ওভারসোল্ড সংকেতগুলির জন্য স্টোক্যাস্টিক আরএসআই দোলক গণনা করে। এটি ওভারকপড/ওভারসোল্ড সূচকের অন্তর্গত।

এই তিনটি মাত্রা জুড়ে সংকেতগুলি একত্রিত করে, যদি সমর্থন / প্রতিরোধ, ভিডাব্লুএপি, এবং স্টোকাস্টিক আরএসআই সবগুলিই কিনতে সংকেত দেয় তবে এটি দীর্ঘ অবস্থান খুলবে। যদি সবগুলি বিক্রয় সংকেত দেয় তবে এটি শর্ট অবস্থান খুলবে।

সুবিধা বিশ্লেষণ

এই কৌশলটির সবচেয়ে বড় সুবিধা হ'ল বিভিন্ন মাত্রা জুড়ে সূচকগুলির সংমিশ্রণ, উচ্চতর জয়ের হারের সাথে বিচারকে আরও বিস্তৃত এবং নির্ভুল করে তোলে। প্রথমে সমর্থন / প্রতিরোধের স্তরগুলি প্রধান প্রবণতা নির্ধারণ করে। তারপরে ভিডাব্লুএপি মাঝারি-দীর্ঘমেয়াদী প্রবণতা নির্ধারণ করে। অবশেষে স্টোকাস্টিক আরএসআই ওভারকোপড / ওভারসোল্ড শর্তের বিচার করে। তিনটি সূচক একই সাথে গুলি করে, এটি কার্যকরভাবে মিথ্যা সংকেতগুলি ফিল্টার করতে পারে এবং প্রবেশের নির্ভুলতা উন্নত করতে পারে।

উপরন্তু, লাভ গ্রহণের ফাংশন লাভের একটি নির্দিষ্ট শতাংশে লক করতে সহায়তা করে, ঝুঁকি ব্যবস্থাপনাকে সহায়তা করে।

ঝুঁকি বিশ্লেষণ

এই কৌশলটির প্রধান ঝুঁকি হ'ল সিদ্ধান্ত গ্রহণের জন্য এটি সমস্ত সূচক থেকে একযোগে সংকেতগুলির উপর নির্ভর করে। যদি কিছু সূচক ত্রুটিযুক্ত সংকেত দেয় তবে এটি ভুল সিদ্ধান্তের দিকে পরিচালিত করতে পারে। উদাহরণস্বরূপ, যখন স্টোক্যাস্টিক আরএসআই ওভারকোপড দেখায় তবে ভিডাব্লুএপি এবং সমর্থন / প্রতিরোধ এখনও উত্থান নির্দেশ করে, এটি প্রবেশ না করে কেনার সুযোগটি মিস করতে পারে।

এছাড়াও, সূচকগুলির অনুপযুক্ত প্যারামিটার টিউনিং ভুল সংকেত বিচারের দিকে পরিচালিত করতে পারে যা অপ্টিমাইজেশনের জন্য পুনরাবৃত্তিমূলক ব্যাকটেস্টিং প্রয়োজন।

অতিরিক্তভাবে, স্বল্পমেয়াদী বাজারে কালো সোয়ান ইভেন্টগুলি সূচকগুলির সংকেতগুলিকে অকার্যকর করতে পারে। এই ঝুঁকি থেকে রক্ষা করার জন্য, পৃথক ব্যবসায়ের নেমে যাওয়া সীমাবদ্ধ করতে স্টপ লস কৌশলগুলি বাস্তবায়ন করা যেতে পারে।

উন্নতির সুযোগ

কৌশলটি নিম্নলিখিত দিকগুলিতে আরও উন্নত করা যেতে পারেঃ

  1. আরও সঠিকতার জন্য প্রবণতা শক্তি পরিমাপ করার জন্য ভলিউমের মতো আরও সূচক সংকেত অন্তর্ভুক্ত করুন।

  2. মেশিন লার্নিং মডেল যোগ করুন মাল্টি-ডাইমেনশনাল ইন্ডিকেটর ট্রেনিং করার জন্য এবং স্বয়ংক্রিয়ভাবে সর্বোত্তম কৌশল আবিষ্কার করুন।

  3. অ্যাডাপ্টিভ টিউনিংয়ের জন্য বিভিন্ন পণ্যের উপর ভিত্তি করে পরামিতিগুলি অপ্টিমাইজ করুন।

  4. স্টপ লস এবং পজিশনের আকার নির্ধারণ করা।

  5. বৈচিত্র্যের জন্য নিম্ন-সমন্বয়যুক্ত পণ্যগুলি খুঁজে পেতে পোর্টফোলিও অপ্টিমাইজেশন সম্পাদন করুন।

সিদ্ধান্ত

সামগ্রিকভাবে এই কৌশলটি স্বল্পমেয়াদী প্রবণতা ট্রেডিংয়ের জন্য উপযুক্ত। মাত্রাগুলি জুড়ে সংকেতগুলি একত্রিত করে, এটি উচ্চতর জয়ের হারের জন্য উল্লেখযোগ্য গোলমাল ফিল্টার করতে পারে। তবে ভুল সংকেতগুলির ঝুঁকি রয়েছে যা আরও উন্নতির মাধ্যমে উন্নত করা যেতে পারে। অব্যাহত অপ্টিমাইজেশনের সাথে, এই কৌশলটির একটি দক্ষ এবং শক্তিশালী স্বল্পমেয়াদী সিস্টেম হওয়ার সম্ভাবনা রয়েছে।


/*backtest
start: 2023-09-24 00:00:00
end: 2023-10-24 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// EmperorBTC's VWAP Indicator & Strategy
//              v2.1
// 
//      coded by Bogdan Vaida

// This indicator was created after EmperorBTC's conditions on Twitter. 
// Good timeframes for it: 30', 15', 5'
// To convert from strategy to study switch the commented lines in the beginning
// and at the end of the script and vice versa.

// What this indicator does is to check if:
// o Pivot Point was crossed
// o Stoch-RSI and VWAP were crossed in current or previous candle
// o Candle (or previous candle) close is in the trend direction
// If all these are true then it will go long or short based on direction.


// FUTURE IDEAS: 
//  - Volume Expansion
//  - Candle Stick patterns

//@version=4

// 🔥Uncomment the line below for the indicator and comment the strategy lines
// study(title="EmperorBTC's VWAP Indicator", shorttitle="EMP-VWAP", overlay=true)

// 🔥 Uncomment the line below for the strategy and comment the above line
strategy(title="EmperorBTC's VWAP Strategy", shorttitle="EMP-VWAP", overlay=true, pyramiding=1)

plotAveragePriceCrossedPivotPoint = input(false, title="Plot Close Price Crossing Pivot Points?", group="Pivot Points")
plotPivotPoints = input(false, title="Plot Pivot Points?", group="Pivot Points")
pivotPointsType = input(title="Pivot Points type", defval="Fibonacci", options=["Fibonacci", "Traditional"], group="Pivot Points")

pivotPointCircleWidth = input(2, title="Width of Pivot Point circles", minval=1, group="Pivot Points")

plotVWAP = input(true, title="Plot VWAP?", group="VWAP")
plotAvgPrice = input(true, title="Plot Average Price?", group="VWAP")
plotVWAPCrossPrice = input(false, title="Plot Price Crossing VWAP?", group="VWAP")
reso = input(title="Period", type=input.resolution, defval="D", group="VWAP")
cumulativePeriod = input(14, "VWAP Cumulative Period", group="VWAP")

plotStochRSICross = input(false, title="Plot StochRSI Cross?", group="StochRSI")
smoothK = input(3, "K", minval=1, group="StochRSI", inline="K&D")
smoothD = input(3, "D", minval=1, group="StochRSI", inline="K&D")
lengthRSI = input(14, "RSI Length", minval=1, group="Stochastic-RSI", inline="length")
lengthStoch = input(14, "Stochastic Length", minval=1, group="Stochastic-RSI", inline="length")
rsiSrc = input(close, title="RSI Source", group="Stochastic-RSI")

plotLong = input(true, title="Plot Long Opportunity?", group="Strategy only")
plotShort = input(true, title="Plot Short Opportunity?", group="Strategy only")
tradingDirection = input(title="Strategy trading Direction: ", defval="L&S", options=["L&S", "L", "S"], group="Strategy only")
takeProfit = input(1.0, title='Take Profit %', group="Strategy only") / 100
plotTP = input(true, title="Plot Take Profit?", group="Strategy only")
startDate = input(title="Start Date", type=input.integer,
     defval=1, minval=1, maxval=31, group="Backtesting range", inline="Start Date")
startMonth = input(title="Start Month", type=input.integer,
     defval=1, minval=1, maxval=12, group="Backtesting range", inline="Start Date")
startYear = input(title="Start Year", type=input.integer,
     defval=2017, minval=1800, maxval=2100, group="Backtesting range", inline="Start Date")
endDate = input(title="End Date", type=input.integer,
     defval=31, minval=1, maxval=31, group="Backtesting range", inline="End Date")
endMonth = input(title="End Month", type=input.integer,
     defval=12, minval=1, maxval=12, group="Backtesting range", inline="End Date")
endYear = input(title="End Year", type=input.integer,
     defval=2050, minval=1800, maxval=2100, group="Backtesting range", inline="End Date")


// PivotPoint code (PVTvX by DGT has some nice code on PP)
candleHigh  = security(syminfo.tickerid,"D", high[1], lookahead=barmerge.lookahead_on)
candleLow   = security(syminfo.tickerid,"D", low[1], lookahead=barmerge.lookahead_on)
candleClose = security(syminfo.tickerid,"D", close[1], lookahead=barmerge.lookahead_on)

pivotPoint = (candleHigh+candleLow+candleClose) / 3

float resistance1 = na
float resistance2 = na
float resistance3 = na
float support1 = na
float support2 = na
float support3 = na

if pivotPointsType == "Fibonacci"
    resistance1 := pivotPoint + 0.382 * (candleHigh - candleLow)
    resistance2 := pivotPoint + 0.618 * (candleHigh - candleLow)
    resistance3 := pivotPoint + (candleHigh - candleLow)
    support1 := pivotPoint - 0.382 * (candleHigh - candleLow)
    support2 := pivotPoint - 0.618 * (candleHigh - candleLow)
    support3 := pivotPoint - (candleHigh - candleLow)
else if pivotPointsType == "Traditional"
    resistance1 := 2 * pivotPoint - candleLow
    resistance2 := pivotPoint + (candleHigh - candleLow)
    resistance3 := candleHigh + 2 * (pivotPoint - candleLow) 
    support1 := 2 * pivotPoint - candleHigh
    support2 := pivotPoint - (candleHigh - candleLow)
    support3 := candleLow - 2 * (candleHigh - pivotPoint)

plot(series = plotPivotPoints ? support1 : na, color=#ff0000, title="S1", style = plot.style_circles, linewidth = pivotPointCircleWidth)
plot(series = plotPivotPoints ? support2 : na, color=#800000, title="S2", style = plot.style_circles, linewidth = pivotPointCircleWidth)
plot(series = plotPivotPoints ? support3 : na, color=#330000, title="S3", style = plot.style_circles, linewidth = pivotPointCircleWidth)
plot(series = plotPivotPoints ? pivotPoint : na, color=#FFA500, title="PP", style = plot.style_circles, linewidth = pivotPointCircleWidth)
plot(series = plotPivotPoints ? resistance1 : na, color=#00FF00, title="R1", style = plot.style_circles, linewidth = pivotPointCircleWidth)
plot(series = plotPivotPoints ? resistance2 : na, color=#008000, title="R2", style = plot.style_circles, linewidth = pivotPointCircleWidth)
plot(series = plotPivotPoints ? resistance3 : na, color=#003300, title="R3", style = plot.style_circles, linewidth = pivotPointCircleWidth)

pivotPointCrossedUp = ((low < support3) and (close > support3)) or ((low < support2) and (close > support2)) or ((low < support1) and (close > support1)) or  ((low < pivotPoint) and (close > pivotPoint))
pivotPointCrossedDown = ((high > support3) and (close < support3)) or ((high > support2) and (close < support2)) or ((high > support1) and (close < support1)) or  ((high > pivotPoint) and (close < pivotPoint))
plotPPColor = pivotPointCrossedUp ? color.green :
     pivotPointCrossedDown ? color.red :
     na

plotshape(series = plotAveragePriceCrossedPivotPoint ? (pivotPointCrossedUp or pivotPointCrossedDown) : na, title="PP Cross", style = shape.triangleup, location=location.belowbar, color=plotPPColor, text="PP", size=size.small)

// VWAP (taken from the TV code)
// There are five steps in calculating VWAP:
//
// 1. Calculate the Typical Price for the period. [(High + Low + Close)/3)]
// 2. Multiply the Typical Price by the period Volume (Typical Price x Volume)
// 3. Create a Cumulative Total of Typical Price. Cumulative(Typical Price x Volume)
// 4. Create a Cumulative Total of Volume. Cumulative(Volume)
// 5. Divide the Cumulative Totals. 
//
// VWAP = Cumulative(Typical Price x Volume) / Cumulative(Volume)

// Emperor's Edition
t = time(reso)
debut = na(t[1]) or t > t[1]

addsource = ohlc4 * volume
addvol = volume
addsource := debut ? addsource : addsource + addsource[1]
addvol := debut ? addvol : addvol + addvol[1]
vwapValue = addsource / addvol

pVWAP = plot(series = plotVWAP ? vwapValue : na, color=color.purple, title="VWAP")
pAvgPrice = plot(series = plotAvgPrice ? ohlc4 : na, color=color.blue, title="PRICE")
fill(pVWAP, pAvgPrice, color = ohlc4 > vwapValue ? color.red : color.green, title="VWAP PRICE FILL")

vwapCrossUp = (low < vwapValue) and (vwapValue < high) and (close > open) // added green candle check
vwapCrossDown = (high > vwapValue) and (vwapValue > low) and (close < open) // added red candle check

plotVWAPColor = vwapCrossUp ? color.green :
     vwapCrossDown ? color.red :
     na
plotshape(series = plotVWAPCrossPrice ? (vwapCrossUp or vwapCrossDown) : na, title="VWAP Cross Price", style=shape.triangleup, location=location.belowbar, color=plotVWAPColor, text="VWAP", size=size.small)


// Stochastic RSI

rsi1 = rsi(rsiSrc, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)

sRsiCrossUp = k[1] < d[1] and k > d
sRsiCrossDown = k[1] > d[1] and k < d

plotColor = sRsiCrossUp ? color.green :
     sRsiCrossDown ? color.red :
     na
plotshape(series = plotStochRSICross ? (sRsiCrossUp or sRsiCrossDown) : na, title="StochRSI Cross Up", style=shape.triangleup, location=location.belowbar, color=plotColor, text="StochRSI", size=size.small)

// Long Trades
sRsiCrossedUp = sRsiCrossUp or sRsiCrossUp[1]
vwapCrossedUp = vwapCrossUp or vwapCrossUp[1]
// longCond1 = (sRsiCross and vwapCross) or (sRsiCross[1] and vwapCross) or (sRsiCross and vwapCross[1])
longCond1 = (sRsiCrossedUp[1] and vwapCrossedUp[1])
longCond2 = pivotPointCrossedUp[1]
longCond3 = (close[1] > open[1]) and (close > open) // check this
longCond = longCond1 and longCond2 and longCond3
plotshape(series = plotLong ? longCond : na, title="Long", style=shape.triangleup, location=location.belowbar, color=color.green, text="Long", size=size.normal)

// Short Trades
sRsiCrossedDown = sRsiCrossDown or sRsiCrossDown[1]
vwapCrossedDown = vwapCrossDown or vwapCrossDown[1]
shortCond1 = (sRsiCrossedDown[1] and vwapCrossedDown[1])
shortCond2 = pivotPointCrossedDown[1]
shortCond3 = (close[1] < open[1]) and (close < open)
shortCond = shortCond1 and shortCond2 and shortCond3
plotshape(series = plotShort ? shortCond : na, title="Short", style=shape.triangledown, location=location.abovebar, color=color.red, text="Short", size=size.normal)

// alertcondition(condition=longCond, title="Long", message="Going long")
// alertcondition(condition=shortCond, title="Short", message="Going short")

// 🔥 Uncomment the lines below for the strategy and revert for the study
takeProfitLong     = strategy.position_avg_price * (1 + takeProfit)
takeProfitShort     = strategy.position_avg_price * (1 - takeProfit)
exitTp = ((strategy.position_size > 0) and (close > takeProfitLong)) or ((strategy.position_size < 0) and (close < takeProfitShort))
strategy.risk.allow_entry_in(tradingDirection == "L" ? strategy.direction.long : tradingDirection == "S" ? strategy.direction.short : strategy.direction.all)
plot(series = (plotTP and strategy.position_size > 0) ? takeProfitLong : na, title="TP Level",color=color.green, style=plot.style_linebr, linewidth=2)
plot(series = (plotTP and strategy.position_size < 0) ? takeProfitShort : na, title="TP Level",color=color.red, style=plot.style_linebr, linewidth=2)
inDateRange = (time >= timestamp(syminfo.timezone, startYear,
         startMonth, startDate, 0, 0)) and (time < timestamp(syminfo.timezone, endYear, endMonth, endDate, 0, 0))
strategy.entry("VWAP", strategy.long, comment="Long", when=longCond and inDateRange)
strategy.entry("VWAP", strategy.short, comment="Short", when=shortCond and inDateRange)
strategy.close(id="VWAP", when=exitTp)
if (not inDateRange)
    strategy.close_all()

আরো