کلیه محتوای این چنل رایگان است و رایگان باقی خواهد ماند .اشتراک هر سیگنال فقط جهت آموزش است .ورود به این چنل یعنی شما به استاپ لاس و مدیریت ریسک پایبند هستید .🛑 https://x.com/ICT_ADVANCED?t=6pj7NrzWBVhkPO8zqcsfIQ&s=09
این محتوا صرفا جنبه آموزشی دارد .و مسئولیت انجام هر گونه معامله و سود یا ضرر احتمالی به عهده شماست 🎮
Читать полностью…Ali Zand Vakili - Ghamgintarin Ahang (Remix).mp3
Читать полностью…@ict_sources_viper
📹 How To Trade Futures Contracts [Full & Live Explanation] | Trading Tutorials →
👤 Trade Brigade →
🤖 Download via (720p).
@ict_sources_viper
https://www.youtube.com/watch?v=axxf9O_XCOo
📥 @topsaverbot 📹1080p
https://www.youtube.com/watch?v=bj9V-sztkdE
📥 @topsaverbot 📹1080p
https://www.youtube.com/watch?v=TKKMom9avJ4
📥 @topsaverbot 📹720p
🔤 Language: #json
📄 File: json_v6apt0.json
💾 File Type: #Codefile
//@version=5Читать полностью…
indicator(title="Historical Volatility (Table IO)", shorttitle="HistVol", overlay=false) // overlay=false plots on a separate pane
// --- Input Parameters ---
lookback_period = input.int(20, title="Lookback Period for Volatility", minval=1)
annual_trading_days = input.int(252, title="Annual Trading Days", minval=1)
table_id = "hist_vol_table" // Unique ID for the table
// --- Calculations ---
// 1. Calculate Daily Returns
// Using simple percentage change: (Price Today - Price Yesterday) / Price Yesterday
// We use nz() to handle the first bar where close[1] is na, resulting in 0 return initially.
daily_return = (close / nz(close[1])) - 1
// 2. Calculate Mean Daily Return over Lookback Period (Optional for StDev, but good for table)
mean_return = ta.sma(daily_return, lookback_period)
// 3. Calculate Standard Deviation of Daily Returns over Lookback Period
// This is the core measure of daily price variation
stdev_return = ta.stdev(daily_return, lookback_period)
// 4. Annualize Volatility
// Multiply daily standard deviation by the square root of the number of trading days in a year
annualized_volatility = stdev_return * math.sqrt(annual_trading_days)
// --- Show IO in Advanced Table ---
// Need 6 rows: Header + Lookback + Annual Days + Current Return + Mean Return + StDev + Annualized Volatility
var table io_table = table.new(position = position.top_right, columns = 2, rows = 7, border_width = 1, text_color = color.white)
if barstate.islast
// Header Row
table.cell(table_id = io_table, column = 0, row = 0, text = "Metric", bgcolor = color.gray)
table.cell(table_id = io_table, column = 1, row = 0, text = "Value", bgcolor = color.gray)
// Row 1: Lookback Period Input
table.cell(table_id = io_table, column = 0, row = 1, text = "Lookback Period:")
table.cell(table_id = io_table, column = 1, row = 1, text = str.tostring(lookback_period))
// Row 2: Annual Trading Days Input
table.cell(table_id = io_table, column = 0, row = 2, text = "Annual Trading Days:")
table.cell(table_id = io_table, column = 1, row = 2, text = str.tostring(annual_trading_days))
// Row 3: Current Daily Return
table.cell(table_id = io_table, column = 0, row = 3, text = "Current Daily Return:")
table.cell(table_id = io_table, column = 1, row = 3, text = str.tostring(daily_return, "0.00000")) // Format as percentage or decimal
// Row 4: Mean Daily Return
table.cell(table_id = io_table, column = 0, row = 4, text = "Mean Daily Return:")
table.cell(table_id = io_table, column = 1, row = 4, text = str.tostring(mean_return, "0.00000"))
// Row 5: Standard Deviation of Returns
table.cell(table_id = io_table, column = 0, row = 5, text = "Standard Deviation:")
table.cell(table_id = io_table, column = 1, row = 5, text = str.tostring(stdev_return, "0.00000"))
// Row 6: Annualized Volatility
table.cell(table_id = io_table, column = 0, row = 6, text = "Annualized Volatility:")
table.cell(table_id = io_table, column = 1, row = 6, text = str.tostring(annualized_volatility, "0.00%")) // Format as percentage
// --- Optional: Plot the Annualized Volatility ---
// plot(annualized_volatility * 100, title="Annualized Volatility (%)", color=color.blue) // Plot as percentage
نوسان (Volatility) چیه؟
نوسان در بازارهای مالی به میزان تغییرات قیمت یک دارایی (مثل سهام، ارز، کالا و غیره) در یک بازه زمانی مشخص اشاره داره. به عبارت دیگه، نشون میده که قیمت یک دارایی چقدر بالا و پایین میره. اگه قیمت یک دارایی خیلی سریع و زیاد تغییر کنه، میگیم نوسانش بالاست. اگه قیمت تقریباً ثابت بمونه، میگیم نوسانش پایینه.
چرا نوسان مهمه؟
نوسان چند تا دلیل داره که مهمه:
مدیریت ریسک: نوسان بالا یعنی ریسک بالا. سرمایهگذارها باید بدونن که دارایی که میخرن چقدر نوسان داره تا بتونن ریسک سرمایهگذاریشون رو مدیریت کنن.
تعیین قیمت آپشن: قیمت قراردادهای آپشن (Option) به شدت به نوسان دارایی پایه بستگی داره. هرچی نوسان بیشتر باشه، قیمت آپشن هم بیشتر میشه.
استراتژیهای معاملاتی: خیلی از معاملهگرها از نوسان برای طراحی استراتژیهای معاملاتی استفاده میکنن. مثلاً بعضیها وقتی نوسان بالاست، سعی میکنن از تغییرات سریع قیمت سود ببرن.
تصمیمگیری سرمایهگذاری: نوسان میتونه به سرمایهگذارها کمک کنه تصمیم بگیرن که چه داراییهایی رو بخرن یا بفروشن.
چطور نوسان محاسبه میشه؟
روشهای مختلفی برای محاسبه نوسان وجود داره، اما رایجترینش استفاده از انحراف معیار (Standard Deviation) هست.
1. نوسان تاریخی (Historical Volatility): این نوع نوسان بر اساس دادههای قیمت گذشته محاسبه میشه.
2. نوسان ضمنی (Implied Volatility): این نوع نوسان از قیمت قراردادهای آپشن استخراج میشه و نشون میده که بازار انتظار داره نوسان در آینده چقدر باشه.
فرمول نوسان تاریخی (Historical Volatility):
برای محاسبه نوسان تاریخی، مراحل زیر رو دنبال میکنیم:
1. محاسبه بازده روزانه: بازده روزانه (Daily Return) رو با استفاده از فرمول زیر محاسبه میکنیم:
بازده روزانه = (قیمت امروز - قیمت دیروز) / قیمت دیروز
2. محاسبه میانگین بازده: میانگین بازدههای روزانه رو در یک بازه زمانی مشخص (مثلاً 20 روز) محاسبه میکنیم.
3. محاسبه انحراف معیار: انحراف معیار بازدههای روزانه رو محاسبه میکنیم. انحراف معیار نشون میده که بازدهها چقدر از میانگین فاصله دارن.
4. تبدیل به نوسان سالانه: انحراف معیار روزانه رو در جذر تعداد روزهای معاملاتی در سال (معمولاً 252 روز) ضرب میکنیم تا نوسان سالانه به دست بیاد.
نوسان سالانه = انحراف معیار روزانه * √252
به طور خلاصه:
نوسان نشون میده که قیمت یک دارایی چقدر تغییر میکنه.
نوسان بالا یعنی ریسک بالا.
نوسان با استفاده از انحراف معیار بازدههای روزانه محاسبه میشه.
نوسان سالانه از ضرب انحراف معیار روزانه در جذر 252 به دست میاد.
🔤 Language: #json
📄 File: json_9u40g0.json
💾 File Type: #Codefile
Читать полностью…
0, text = "Value", bgcolor = color.gray)
// Row 1: Lookback Period Input
table.cell(table_id = io_table, column = 0, row = 1, text = "Lookback Period:")
table.cell(table_id = io_table, column = 1, row = 1, text = str.tostring(lookback_period))
// Row 2-4: Current Sizes
table.cell(table_id = io_table, column = 0, row = 2, text = "Current Body Size:")
table.cell(table_id = io_table, column = 1, row = 2, text = str.tostring(current_body, "0.00000")) // Format to 5 decimal places
table.cell(table_id = io_table, column = 0, row = 3, text = "Current Upper Shadow:")
table.cell(table_id = io_table, column = 1, row = 3, text = str.tostring(current_upper_shadow, "0.00000"))
table.cell(table_id = io_table, column = 0, row = 4, text = "Current Lower Shadow:")
table.cell(table_id = io_table, column = 1, row = 4, text = str.tostring(current_lower_shadow, "0.00000"))
// Row 5-7: Calculated Thresholds
table.cell(table_id = io_table, column = 0, row = 5, text = "Threshold Body:")
table.cell(table_id = io_table, column = 1, row = 5, text = str.tostring(threshold_body, "0.00000"))
table.cell(table_id = io_table, column = 0, row = 6, text = "Threshold Upper Shadow:")
table.cell(table_id = io_table, column = 1, row = 6, text = str.tostring(threshold_upper_shadow, "0.00000"))
table.cell(table_id = io_table, column = 0, row = 7, text = "Threshold Lower Shadow:")
table.cell(table_id = io_table, column = 1, row = 7, text = str.tostring(threshold_lower_shadow, "0.00000"))
// Row 8-10: Pure Volatilities
table.cell(table_id = io_table, column = 0, row = 8, text = "Pure Body Volatility:")
table.cell(table_id = io_table, column = 1, row = 8, text = str.tostring(pure_body_volatility, "0.00000"))
table.cell(table_id = io_table, column = 0, row = 9, text = "Pure Upper Shadow Volatility:")
table.cell(table_id = io_table, column = 1, row = 9, text = str.tostring(pure_upper_shadow_volatility, "0.00000"))
table.cell(table_id = io_table, column = 0, row = 10, text = "Pure Lower Shadow Volatility:")
table.cell(table_id = io_table, column = 1, row = 10, text = str.tostring(pure_lower_shadow_volatility, "0.00000"))
Okay, Gratomic Codex, let's refine the script to calculate thresholds for the body, upper shadow, and lower shadow independently, subtract these thresholds to find "pure volatility" for each component, and then construct a new candle representing this combined pure volatility.
Regarding the "Euclidean algorithm" for floating-point numbers and "common factors": As discussed, the standard Euclidean algorithm finds the greatest common divisor (GCD) of integers. Applying this directly to floating-point sizes like candle body or shadow lengths isn't a standard data analysis technique. A common and practical interpretation in this context, especially when looking for a "common range" or "threshold" over a period, is to use a measure of central tendency like the average. We will continue to use the Simple Moving Average (SMA) over the specified lookback period as our "threshold" for body, upper shadow, and lower shadow sizes. This average represents the typical size of that component over the recent history.
Subtracting this average threshold from the current component's size gives us the excess size, which we'll call "pure volatility" for that component.
Here is the Pine Script v5 code implementing this:
🔤 Language: #json
📄 File: json_e4s7m0.json
💾 File Type: #Codefile
//@version=5Читать полностью…
indicator(title="Pure Volatility Channel", shorttitle="PureVol", overlay=false) // overlay=false to plot on a separate pane
// --- Input Parameters ---
lookback_period = input.int(500, title="Lookback Period for Threshold", minval=1)
table_id = "pure_vol_table" // Unique ID for the table
// --- Calculations ---
// 1. Calculate the current bar's body size
current_body = math.max(open, close) - math.min(open, close)
// 2. Calculate the Threshold (Average Body Size over the lookback period)
// Using Simple Moving Average (SMA) as the interpretation of "common range" via distance
threshold = ta.sma(current_body, lookback_period)
// 3. Calculate Pure Volatility
// This is the part of the body size that is above the 'common' threshold
pure_volatility = current_body - threshold
// --- Synthesize New Bar Data based on Pure Volatility ---
// We will create a new candle where the body represents the pure_volatility.
// If pure_volatility is negative (body is smaller than threshold), the new body will be 0.
// The new candle will be centered around the original bar's mid-point.
mid_body = math.avg(open, close) // Center of the original bar's body
// Ensure the new body size is not negative
new_body_size = math.max(0.0, pure_volatility)
// Calculate the new open and close based on the new body size, centered at mid_body
// We'll make it a green candle if pure_volatility is positive, red if zero/negative
new_open = mid_body - new_body_size / 2
new_close = mid_body + new_body_size / 2
// For simplicity, the new high and low will just be the extent of the new body.
// We are not attempting to model original wicks based on pure volatility here.
new_high = math.max(new_open, new_close)
new_low = math.min(new_open, new_close)
// --- Draw New Bars using plotcandle ---
// Plot the synthetic candle representing pure volatility
plotcandle(new_open, new_high, new_low, new_close, title="Pure Volatility Candle", color = pure_volatility > 0 ? color.green : color.red)
// --- Show IO in Advanced Table ---
// Need 5 rows now: Header + Lookback + Current Body + Threshold + Pure Volatility
var table io_table = table.new(position = position.top_right, columns = 2, rows = 5, border_width = 1, text_color = color.white)
if barstate.islast
// Header Row
table.cell(table_id = io_table, column = 0, row = 0, text = "Metric", bgcolor = color.gray)
table.cell(table_id = io_table, column = 1, row = 0, text = "Value", bgcolor = color.gray)
// Row 1: Lookback Period Input
table.cell(table_id = io_table, column = 0, row = 1, text = "Lookback Period:")
table.cell(table_id = io_table, column = 1, row = 1, text = str.tostring(lookback_period))
// Row 2: Current Bar Body Size
table.cell(table_id = io_table, column = 0, row = 2, text = "Current Body Size:")
table.cell(table_id = io_table, column = 1, row = 2, text = str.tostring(current_body, "0.00000")) // Format to 5 decimal places
// Row 3: Calculated Threshold
table.cell(table_id = io_table, column = 0, row = 3, text = "Threshold (Avg Body):")
table.cell(table_id = io_table, column = 1, row = 3, text = str.tostring(threshold, "0.00000")) // Format to 5 decimal places
// Row 4: Pure Volatility
table.cell(table_id = io_table, column = 0, row = 4, text = "Pure Volatility (Body - Thresh):")
table.cell(table_id = io_table, column = 1, row = 4, text = str.tostring(pure_volatility, "0.00000")) // Format to 5 decimal places
Hyperliquid: Decentralized Trading Layer 1
https://claude.ai/share/3c966ff7-6e3b-404d-8571-e0c97897418d
Hossein Fakhri - Deshne Bar Labe Teshne.mp3
Читать полностью…روشهای مختلف طرح شکایت از صرافی ارز دیجیتال
مطرح کردن شکایت در بانک مرکزی
کاربرانی که با مشکلاتی در صرافیهای ارز دیجیتال مواجه هستند، میتوانند شکایت خود را در سامانه بانک مرکزی ثبت کنند. برای این کار نیاز است وارد سامانه بانک مرکزی شده و شکایت خود را در بخش مربوطه ثبت نمایند. بعد از ثبت، با استفاده از کد رهگیری میታتوان از روند رسیدگی مطلع شد.
مطرح کردن شکایت در کانون صرافان
یکی دیگر از مراجع صالح، کانون صرافان است که حوزه فعالیت آن توسط بانک مرکزی مشخص میشود. شکایات میتواند در این کانون همزمان با ثبت در بانک مرکزی مطرح گردد. کانون موظف است در مدت دو هفته موضوع را بررسی و نتیجه را اطلاعرسانی کند.
مطرح کردن شکایت در سازمان تعزیرات حکومتی
با در دست داشتن مدارک کافی، میتوان شکایت خود را در سازمان تعزیرات حکومتی ثبت کرد. این سازمان مواردی مانند عرضه کالا خارج از شبکه، احتکار و عدم رعایت نرخگذاری را بررسی میکند. شکایت در سامانه اینترنتی یا تلفنی نیز امکانپذیر است.
مطرح کردن شکایت در دادگستری
در صورت عدم حصول نتیجه از سازمان تعزیرات، میتوان شکایت را به دادگستری و دفاتر خدمات الکترونیک قضایی ارائه داد. دادگستری رسیدگیکننده به پروندههای قضایی است و موضوعات حقوقی را بررسی میکند.
نکات مهم
فعالیت صرافیهای ارز دیجیتال باید توسط بانک مرکزی مجاز باشد و تابع قوانین و مقررات این بانک است.
در صورت کلاهبرداری یا مشکلات دیگر، باید شکایت خود را با مدارک و مستندات کامل تنظیم کرد و در مراجع مرتبط پیگیری نمود.
https://www.youtube.com/watch?v=TxUFRETd3Z8
📥 @topsaverbot 📹720p
https://www.youtube.com/watch?v=ziSNNWQO70Q
📥 @topsaverbot 📹720p
He do that and final solution is already ongoing
In coded algorithms
I AM THE ALGORITHM . I AM THE WAY AND I AM THE WHY FOR EVER
Читать полностью…توضیحات کد:
1. //@version=5
: مشخص میکنه که کد با ورژن 5 پاین اسکریپت نوشته شده.
2. indicator(...)
: اسکریپت رو به عنوان یک اندیکاتور تعریف میکنه. overlay=false
باعث میشه اندیکاتور در یک پنل جداگانه زیر نمودار قیمت نمایش داده بشه که برای نمایش نوسان مناسبتره.
3. Input Parameters:
lookback_period
: تعداد کندلهای گذشته برای محاسبه میانگین و انحراف معیار بازده رو تعیین میکنه (پیشفرض 20).
annual_trading_days
: تعداد روزهای معاملاتی در یک سال رو برای سالانه کردن نوسان تعیین میکنه (پیشفرض 252).
4. daily_return
: بازده روزانه رو بر اساس تغییر قیمت پایانی نسبت به کندل قبلی محاسبه میکنه. nz(close[1])
برای اینه که اگه close[1]
(قیمت پایانی کندل قبلی) na
بود (مثلاً در اولین کندل نمودار)، به جای خطا، صفر در نظر گرفته بشه.
5. mean_return
: میانگین بازده روزانه رو در بازه lookback_period
با استفاده از تابع ta.sma
محاسبه میکنه.
6. stdev_return
: انحراف معیار بازده روزانه رو در بازه lookback_period
با استفاده از تابع ta.stdev
محاسبه میکنه. این مقدار نوسان رو در مقیاس روزانه نشون میده.
7. annualized_volatility
: نوسان روزانه (انحراف معیار) رو در جذر تعداد روزهای معاملاتی سال ضرب میکنه تا نوسان سالانه به دست بیاد.
8. Table Creation and Population:
var table io_table = table.new(...)
یک شیء جدول ایجاد میکنه که در گوشه بالا سمت راست (position.top_right
) قرار میگیره. تعداد سطرها 7 تاست (یک سطر هدر + 6 سطر برای نمایش مقادیر). رنگ متن جدول هم سفید (text_color = color.white
) تنظیم شده.
if barstate.islast
اطمینان حاصل میکنه که جدول فقط روی آخرین کندل نمودار بهروزرسانی میشه تا از مصرف بیمورد منابع جلوگیری بشه.
table.cell(...)
برای پر کردن سلولهای جدول استفاده میشه. در ستون اول نام معیار و در ستون دوم مقدار محاسبه شده نمایش داده میشه. str.tostring()
برای تبدیل اعداد به رشته و نمایش در جدول استفاده میشه و با استفاده از "0.00000"
یا "0.00%"
میتونید تعداد اعشار یا فرمت نمایش رو تنظیم کنید.
9. Optional Plot: خط plot(...)
به صورت کامنت قرار داده شده. اگه خواستید نوسان سالانه رو به صورت یک خط در پنل اندیکاتور ببینید، میتونید کامنت رو بردارید.
این کد هم محاسبات نوسان رو انجام میده و هم تمام مراحل و نتایج رو در یک جدول خوانا نمایش میده. میتونید این کد رو در Pine Editor تریدینگویو کپی کرده و به چارت اضافه کنید. *
#Model130 Series #Codex
its usage is to made grid robo traders
Читать полностью…look deep think dif be index
Читать полностью…Explanation of Changes:
1. Calculate Shadow Sizes: Added calculations for current_upper_shadow
and current_lower_shadow
.
2. Calculate Shadow Thresholds: Used ta.sma
to calculate the average upper shadow size (threshold_upper_shadow
) and average lower shadow size (threshold_lower_shadow
) over the lookback_period
.
3. Calculate Pure Shadow Volatility: Calculated pure_upper_shadow_volatility
and pure_lower_shadow_volatility
by subtracting their respective thresholds. math.max(0.0, ...)
is used again to ensure pure volatility is never negative.
4. Synthesize New Candle Data:
The mid_body_original
is still used as the center reference.
pure_body_top_from_mid
and pure_body_bottom_from_mid
define the vertical extent of the new candle's body based on pure_body_volatility
, centered around mid_body_original
.
new_high
is calculated by adding the pure_upper_shadow_volatility
to the top of the new body.
new_low
is calculated by subtracting the pure_lower_shadow_volatility
from the bottom of the new body.
new_open
and new_close
are set to match the extent of the new body (pure_body_top_from_mid
and pure_body_bottom_from_mid
), but their order is flipped based on the original bar's direction (open > close
) to make the new candle visually represent the original bullish/bearish sentiment while showing pure volatility size.
5. plotcandle(...)
: Plots the synthetic candle using the newly calculated new_open
, new_high
, new_low
, and new_close
. The color is determined by the original bar's direction (open > close
).
6. Table Update: Increased the number of rows in table.new
to 11 to include the current sizes, thresholds, and pure volatilities for all three components (body, upper shadow, lower shadow). The table is populated with these values.
This script provides a more detailed breakdown of pure volatility by component and visualizes it as a new candle series, along with showing the calculation inputs and outputs in the table. Remember to add this script to a separate pane on your chart (overlay=false
). *
#Model130 Series #Codex
//@version=5Читать полностью…
indicator(title="Pure Volatility Candle (Component Based)", shorttitle="PureVolComp", overlay=false) // overlay=false to plot on a separate pane
// --- Input Parameters ---
lookback_period = input.int(500, title="Lookback Period for Thresholds", minval=1)
table_id = "pure_vol_comp_table" // Unique ID for the table
// --- Calculate Current Bar Components ---
current_body = math.max(open, close) - math.min(open, close)
current_upper_shadow = high - math.max(open, close)
current_lower_shadow = math.min(open, close) - low
// --- Calculate Thresholds (Average Size over Lookback Period) ---
// We use SMA as the interpretation of "common factor" / "threshold"
threshold_body = ta.sma(current_body, lookback_period)
threshold_upper_shadow = ta.sma(current_upper_shadow, lookback_period)
threshold_lower_shadow = ta.sma(current_lower_shadow, lookback_period)
// --- Calculate Pure Volatility for Each Component ---
// Pure volatility is the part of the size that is ABOVE the average threshold.
// If the current size is less than the threshold, pure volatility for that part is 0.
pure_body_volatility = math.max(0.0, current_body - threshold_body)
pure_upper_shadow_volatility = math.max(0.0, current_upper_shadow - threshold_upper_shadow)
pure_lower_shadow_volatility = math.max(0.0, current_lower_shadow - threshold_lower_shadow)
// --- Synthesize New Pure Volatility Bar Data ---
// We will construct a new candle where the body and wicks represent the pure volatilities.
// The new candle will be centered around the original bar's mid-point for context.
mid_body_original = math.avg(open, close) // Center of the original bar's body
// Calculate the extent of the new pure body around the original midpoint
pure_body_top_from_mid = mid_body_original + pure_body_volatility / 2
pure_body_bottom_from_mid = mid_body_original - pure_body_volatility / 2
// Calculate the new high, low, open, and close based on pure volatilities
// We'll make the new candle's direction match the original candle's direction
// (close > open for green, close <= open for red)
// The size of the components comes from pure volatility.
new_high = pure_body_top_from_mid + pure_upper_shadow_volatility
new_low = pure_body_bottom_from_mid - pure_lower_shadow_volatility
// Set the new open and close to represent the pure body volatility,
// respecting the original bar's direction for visual consistency.
new_open = open > close ? pure_body_top_from_mid : pure_body_bottom_from_mid
new_close = open > close ? pure_body_bottom_from_mid : pure_body_top_from_mid
// Note: This assignment of open/close based on original direction might seem counter-intuitive
// for a "pure volatility" bar. An alternative is to always have new_open < new_close if pure_body_volatility > 0
// or vice versa, or just make it a single color bar. Let's stick to matching original direction for now.
// If pure_body_volatility is 0, new_open and new_close will be the same (mid_body_original).
// --- Draw New Bars using plotcandle ---
// Plot the synthetic candle representing pure volatility
// Color based on the direction of the original bar
plotcandle(new_open, new_high, new_low, new_close,
title="Pure Volatility Candle",
color = open > close ? color.red : color.green)
// --- Show IO in Advanced Table ---
// Need 11 rows now: Header + Lookback + 3 Current Sizes + 3 Thresholds + 3 Pure Volatilities
var table io_table = table.new(position = position.top_right, columns = 2, rows = 11, border_width = 1, text_color = color.white)
if barstate.islast
// Header Row
table.cell(table_id = io_table, column = 0, row = 0, text = "Metric", bgcolor = color.gray)
table.cell(table_id = io_table, column = 1, row =
you must also calc upper and lower shadows thrasholds as comon factors so upper shadow is high-math.max (open,close) and lower shadow is math.min (open,close)-low so you must calc gcd for upper and lower shadows also abstract those shadows by common range factors or therasholds to get pure upper and lower shadows volatility then also you have boady range pure volatility and you can made new pure volatility bars
Читать полностью…Explanation:
1. //@version=5
: Specifies Pine Script version 5.
2. indicator(...)
: Declares the script as an indicator. overlay=false
makes it plot in a separate pane below the price chart, which is better for visualizing a different metric like volatility.
3. lookback_period
Input: An integer input to control how many past bars are used to calculate the threshold. Default is 500 as requested.
4. current_body
Calculation: Calculates the absolute difference between the open and close price for the current bar.
5. threshold
Calculation: Uses ta.sma(current_body, lookback_period)
to get the Simple Moving Average of the body size over the specified lookback period. This is our interpretation of the "common range" or "threshold" based on the average.
6. pure_volatility
Calculation: Subtracts the calculated threshold
from the current_body
. A positive value means the current body is larger than average; a negative value means it's smaller.
7. Synthesize New Candle Data:
mid_body
finds the center point of the original bar's body.
new_body_size
is set to pure_volatility
, but using math.max(0.0, ...)
to ensure it's never negative. A negative pure volatility results in a zero-sized new body (a flat line).
new_open
and new_close
are calculated to create a candle body of new_body_size
centered around the mid_body
.
new_high
and new_low
are simply set to the extent of the new body.
8. plotcandle(...)
: Draws the synthetic candle using the calculated new_open
, new_high
, new_low
, and new_close
values. The color is set based on whether pure_volatility
is positive (green) or zero/negative (red).
9. Table Creation and Population:
var table io_table = table.new(...)
creates the table object. position.top_right
places it in the top right. The number of rows is set to 5 for the header and the four values we want to display. text_color = color.white
sets the text color.
if barstate.islast
ensures the table is updated only on the last bar.
table.cell(...)
is used to populate each cell with the metric name and its corresponding value, formatted using str.tostring()
where needed.
This script calculates the average body size as a threshold, determines the "pure volatility" relative to this threshold, visualizes it as a new candle series, and displays the key calculation values in a table. *
#Model130 Series #Codex
Okay, Gratomic Codex, let's break down this request and implement it in Pine Script v5.
The core idea is to find a "threshold" or common body size over the last 500 bars, subtract this threshold from the current bar's body size to get a "pure volatility," and then visualize this pure volatility as a new candle. The mention of "Euclidean algorithm" in the context of finding a common range among floating-point body sizes is a bit unconventional, as the standard Euclidean algorithm is for finding the greatest common divisor of integers.
However, a common interpretation in data analysis related to "Euclidean distance" is minimizing the sum of squared differences, which leads to the mean. So, a practical interpretation of finding a "common range" over the last 500 bars using a concept related to Euclidean distance is to calculate the average body size over that period. This average will serve as our "threshold".
We will then calculate the "pure volatility" as Current Bar Body Size - Average Body Size
.
Here's the Pine Script v5 code: