
এই কৌশলটি Z- স্কোরের উপর ভিত্তি করে একটি পরিসংখ্যানগত ধারণার উপর ভিত্তি করে, যা মূল্যের স্থানীয় গড়ের তুলনায় পরিসংখ্যানগত বিচ্যুতি সনাক্ত করার জন্য ব্যবহৃত হয়। এই কৌশলটি Z- স্কোরের সমাপ্তির মূল্য গণনা করে এবং তারপরে Z স্কোরের সমতলীকরণের জন্য স্বল্পমেয়াদী এবং দীর্ঘমেয়াদী চলমান গড় প্রয়োগ করে।
এই কৌশলটির কেন্দ্রবিন্দু হল Z স্কোরের গণনা এবং প্রয়োগ। Z স্কোর হল একটি পরিসংখ্যান যা একটি ডাটা পয়েন্টের নমুনা গড়ের থেকে বিচ্যুতির মাত্রা পরিমাপ করে, স্ট্যান্ডার্ড ডিভেরিয়েন্ট হিসাবে। এই কৌশলটিতে, Z স্কোর গণনার সূত্রটি হলঃ Z = (সমাপ্তি মূল্য - SMA ((সমাপ্তি মূল্য, N)) / STDEV ((সমাপ্তি মূল্য, N)) যেখানে N হল ব্যবহারকারীর সংজ্ঞায়িত মৌলিক চক্র।
এই নীতির কার্যকরকরণ নিম্নরূপঃ
অতিরিক্ত শর্তাবলীর মধ্যে রয়েছেঃ
সমাধানঃ
মসৃণ জেড রেটিং ক্রস-ভিত্তিক গতিশীল অপ্টিমাইজড মূল্যের পরিসংখ্যান ট্রেডিং কৌশলটি একটি পরিসংখ্যানগত নীতির উপর ভিত্তি করে একটি সহজ ট্রেডিং সিস্টেম যা মূল্যের স্থানীয় গড়ের তুলনায় বিচ্যুতি এবং প্রত্যাবর্তনের উপর দৃষ্টি নিবদ্ধ করে। মসৃণ প্রক্রিয়াকরণ, সংকেত ব্যবধান নিয়ন্ত্রণ এবং গতিশীলতা ফিল্টারিংয়ের মাধ্যমে, কৌশলটি কার্যকরভাবে শব্দ বাণিজ্যকে হ্রাস করে এবং সংকেতের গুণমানকে উন্নত করে। এই কৌশলটি বিশেষত অস্থির বাজার এবং আর্থিক পণ্যগুলির জন্য উপযুক্ত যা সমতুল্য প্রত্যাবর্তনের আচরণে স্পষ্ট।
যাইহোক, কৌশলগুলির কিছু সীমাবদ্ধতা রয়েছে, যেমন পরিসংখ্যানগত অনুমান, প্যারামিটার সংবেদনশীলতা এবং একক ফ্যাক্টর সিদ্ধান্তের উপর নির্ভরশীলতা। প্রবণতা সনাক্তকরণ, অস্থিরতা সমন্বয়, মাল্টি-টাইম ফ্রেম বিশ্লেষণ, স্টপ লস মেশিন, ক্রয় পরিমাণ নিশ্চিতকরণ এবং মাল্টি ফ্যাক্টর সমন্বয় ইত্যাদির মতো অপ্টিমাইজেশনের পদক্ষেপগুলি যুক্ত করে কৌশলগুলির রুক্ষতা এবং কার্যকারিতা উল্লেখযোগ্যভাবে বাড়ানো যেতে পারে।
সামগ্রিকভাবে, এটি একটি দৃঢ় তাত্ত্বিক ভিত্তি, একটি সংক্ষিপ্ত, সহজে বোঝা এবং প্রসারিত কৌশলগত কাঠামো যা ট্রেডিং সিস্টেমের মৌলিক উপাদান হিসাবে বা ট্রেডারদের ট্রেডিংয়ে পরিসংখ্যানের প্রয়োগ বুঝতে সহায়তা করার জন্য একটি শিক্ষামূলক সরঞ্জাম হিসাবে উপযুক্ত।
/*backtest
start: 2024-06-03 00:00:00
end: 2025-06-02 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("Price Statistical Strategy-Z Score V 1.01", overlay=true)
// === Enable / Disable Z-Score Strategy Block ===
enableZScore = input.bool(true, title="Enable Smoothed Z-Score Strategy", tooltip="When enabled, this block calculates a smoothed Z-Score of the closing price and generates entry/exit signals based on crossover behavior between short-term and long-term smoothed Z-Scores.\n\nRecommended for quick and classic detection of price deviation from mean.\nSensitive to outliers. Best suited for relatively normal-distributed market conditions.")
// === Z-Score Parameters ===
zBaseLength = input.int(3, minval=1, title="Z-Score Base Period")
shortSmooth = input.int(3, title="Short-Term Smoothing")
longSmooth = input.int(5, title="Long-Term Smoothing")
// === Z-Score Calculation Function ===
f_zscore(src, length) =>
mean = ta.sma(src, length)
std_dev = ta.stdev(src, length)
z = (src - mean) / std_dev
z
// === Z-Score Logic ===
zRaw = f_zscore(close, zBaseLength)
zShort = ta.sma(zRaw, shortSmooth)
zLong = ta.sma(zRaw, longSmooth)
// === Minimum gap between identical signals ===
gapBars = input.int(5, minval=1, title="Bars gap between identical signals", tooltip="Minimum number of bars required between two identical signals (entry or exit). Helps reduce signal noise.")
// === Candle-based momentum filters ===
bullish_3bars = close > close[1] and close[1] > close[2] and close[2] > close[3] and close[3] > close[4]
bearish_3bars = close < close[1] and close[1] < close[2] and close[2] < close[3] and close[3] < close[4]
// === Entry and Exit Logic with minimum signal gap and candle momentum filter ===
var int lastEntryBar = na
var int lastExitBar = na
if enableZScore
longCondition = (zShort > zLong)
exitCondition = (zShort < zLong)
if longCondition and (na(lastEntryBar) or bar_index - lastEntryBar > gapBars) and not bullish_3bars
strategy.entry("Z Score", strategy.long)
lastEntryBar := bar_index
if exitCondition and (na(lastExitBar) or bar_index - lastExitBar > gapBars) and not bearish_3bars
strategy.close("Z Score", comment="Z Score")
lastExitBar := bar_index
// === Real-time PnL Table for Last Open Position ===
var table positionTable = table.new(position.bottom_right, 2, 2, border_width=1)
// Header Labels
table.cell(positionTable, 0, 0, "Entry Price", text_color=color.white, bgcolor=color.gray)
table.cell(positionTable, 1, 0, "Unrealized PnL (%)", text_color=color.white, bgcolor=color.gray)
// Values (only when position is open)
isLong = strategy.position_size > 0
entryPrice = strategy.position_avg_price
unrealizedPnL = isLong ? (close - entryPrice) / entryPrice * 100 : na
// Define dynamic text color for PnL
pnlColor = unrealizedPnL > 0 ? color.green : unrealizedPnL < 0 ? color.red : color.gray
// Update Table Content
if isLong
table.cell(positionTable, 0, 1, str.tostring(entryPrice, "#.####"), text_color=color.gray, bgcolor=color.new(color.gray, 90))
table.cell(positionTable, 1, 1, str.tostring(unrealizedPnL, "#.##") + " %", text_color=pnlColor, bgcolor=color.new(pnlColor, 90))
else
table.cell(positionTable, 0, 1, "—", text_color=color.gray, bgcolor=color.new(color.gray, 90))
table.cell(positionTable, 1, 1, "—", text_color=color.gray, bgcolor=color.new(color.gray, 90))