JustUncleL

Daily Historical Volatility StdDev Levels

‎2358‎ مشاهدة
314
2358 12
Description:
This indicator plots Daily Standard deviation levels on price chart based on Historical Volatility (HV). It uses the most common approach for calculating historical volatility as standard deviation of logarithmic returns, based on daily closing/settlement prices.

Assets: Currency Pairs, Commodities , also works on stocks, some indices.
Time Frames: 5min to 60min. This will also work on Daily Chart , by setting "DaystoExpire" to 21

Options:
  • Use Daily Data to Calculate StdDev HV (default), otherwise use the charts Time Frame
  • Lookback = number of days/periods to calculate stddev of HV (21 by default)
  • Annual = number of trading days in a calender year (252 by default)
  • Days to Expiry = number of days for the life of this option ( for auto calculation
    this is 1 for intraday, 21 for daily and annual when chart TF used)
  • Settlement Source = close price by default, can use another source.
  • Settlement Volume Weighted Average Length = by setting this to >1 then an average
    is used for settlement.
  • Display ### Standard Deviation Levels = select what levels are to be displayed.

References:
ملاحظات الأخبار: Corrected Change of day detection for Intraday TFs
Corrected -0.75 Label.
ملاحظات الأخبار: Small changes:
  • Changed to only display background fill for upto +/- 1 Stddev.
  • Added option to Display Todays Only Levels.
ملاحظات الأخبار: ...
  • Made changes so that it also work with Renko Charts, BUT only works well with short TF (<=5min) and brick (<=6pip).
  • Added Option to display Previous Day's High Low Levels.
  • Added Option to display Current Day's High Low Levels.
  • Changed 0.75 level to 0.7 level.
  • Shortened short title to "HVSD" for easier visual when Indicator Labels are used.
ملاحظات الأخبار: ...
  • Modified the way displaying "Only Today" levels, now only show up within the current days price action.

ملاحظات الأخبار: Efficiency Update
  • Improved efficiency by reducing the number of plot lines required by adding "style=2" (Line with Breaks) to the plot options.
  • Added fill colour for 2nd and 3rd Stddevs.

ملاحظات الأخبار: Minor update
  • Corrected no History flag "nohist" calculation, would misread the number of days of data left in the history.
إزالة من البرامج النصية المفضلة أضف إلى البرامج النصية المفضلة
JustUncleL
Question: if you state: // get the Daily Settlement

settlement = sLength==1? src : vwma(src,sLength)
settlement := newDay ? settlement : nz(settlement)

Then you call:

// Calculate STDdev over life of the option (generally this is one day for 5min to 60min TFs,
// and 21 days for Daily TF)
stdhv = 0.0
DaystoExpire = DaystoExpire_==0? isintraday? useDaily? 1 : min(annual,1440/interval) : 21 : DaystoExpire_
stdhv := newDay? settlement*hv*sqrt(DaystoExpire/annual) : nz(stdhv)


To which of the settlements then the program is referring to?

Thanks.
رد
JustUncleL syracusepro
@syracusepro, Settlement is generally the last close (src) value of the previous Day, there is an option to create a volume weighted average of close instead. So basically the value for settlement used in subsequent calculations is always the same until the next change of Day.
رد
syracusepro JustUncleL
@JustUncleL, Thanks a lot.
رد
Long waiting for this script to be here in TV. Thanks JustUncleL for your effort and generosity making this available for the whole community. Each line represents the EXPECTED move of the price based on the standard deviation formula using the historical volatility data of the underlying. Just drop the indicator on any chart and see for your self how nicely the price has reacted when has reached those lines. Nicely done UncleL thank you very much!
+1 رد
Very very nice work.

Hopefully it can work on indices in the future. Thank you!
رد
@edin228, I have updated the script with a correction on new Day detection. This update now seems to work OK on indices better, give it a try. I had a bit of trouble getting the new day detection to work until I added the flags barmerge.gaps_off and barmerge.lookahead_on to the security call for Daily time.
رد
edin228 JustUncleL
@JustUncleL, Works perfectly! thank you very much, excellent work
رد
It is start = security(tickerid,"D", time) such as NY trading start time and then
it is newDay = isintraday ? hour(time)==hour(start) and minute(time)==minute(start) : dayofmonth(time)<dayofmonth(time) such as time from start trading time to time before end if day?

Thanks.
رد
JustUncleL syracusepro
@syracusepro, Yes, however, I have now changed the new day detection in the latest correction. The old code did not always work when there is a gap in the data stream at the start of day.
رد
syracusepro JustUncleL
@JustUncleL, I see that on: newDay = isintraday ? change(start) : dayofmonth(time)<dayofmonth(time), it seems to me this means " it is intraday then the difference from start time to end time is less then todays dayofmonth time less than dayofmonth time"?
رد
الصفحة الرئيسية منصة الأسهم منصًة العملات منصّة العملات الرقمية جدول الأعمال الاقتصادي كيف نعمل مميزات الرسم البياني أسعار العضوية قوانين الموقع المشرفون حلول المواقع الإلكترونية والوسطاء الأدوات حلول الرسوم البيانية مركز المساعدة طلب الخصائص المدوّنة والأخبار الأسئلة الأكثر شيوعًا معرفة تويتر
الملف الشخصي إعدادات الصفحة الشخصية الحساب وإعداد الفواتير عملات TradingView تذاكر الدعم الخاصة بي مركز المساعدة أفكاري المنشورة المتابعين تتابع رسالة خاصة المحادثة تسجيل الخروج