The default (and only) "hv" forecast is based on the assumption that today's will hold for the next M days.
To use this script, only one step is mandatory. You must first select days to expiration. The script will not do anything until this value is changed from the default (-1). These should be CALENDAR days. The script will convert to these to business days for forecasting and valuation, as trading in most contracts occurs over ~250 business days per year.
Adjust any other variables as desired:
model: the forecasting model
window: the number of periods for a lagged model (e.g. hv)
filter: a filter to remove forecasts from the sample
filter type: "none" (do not use the filter), "less than" (keep forecasts when filter < ), "greater than" (keep forecasts when filter > )
filter value: a whole number percentage. see example below
discount rate: to discount the expected value to present value
precision: number of decimals in output
trim outliers: omit upper N % of (generally itm ) contracts
The theoretical values are based on history. For example, suppose days to expiration is 30. On every bar, the 30 days ago N deviation forecast value is compared to the present price. If the price is above the forecast value, the contract has expired in the money; otherwise, it has expired worthless. The theoretical value is the average of every such sample. The itm probabilities are calculated the same way.
The default (and only) model is a 20 period EWMA derived historical (realized) . Feel free to extend the script by adding your own.
The filter parameters can be used to remove some forecasts from the sample.
filter type: none
filter value: <any>
Default: the filter is not used; all forecasts are included in the the sample.
filter type: less than
filter value: 50
If the model is "hv", this will remove all forecasts when the is greater than fifty.
filter type: greater than
filter value: 75
If the model is in the top 25% of the previous year's range, the forecast will be included in the sample apart from "model" there are some common indexes to choose from, such as Nasdaq ( VXN ), crude oil ( OVX ), emerging markets ( VXFXI ), S&P ( ) etc.
Refer to the middle-right table to see the current forecast value, its rank among the last 252 days, and the number of business days until
NOTE: This script is meant for the only.
- added current volatility (model and value) to a table in the center right
- added a filter
The first two are essential for the new filter feature. The filter removes data points from the sample. For example, if set to "less than" and "0.4" (as in the sample chart), the sample will exclude all forecasts made when volatility exceeded 40%. In this natural gas example, the historical volatility model is over 40% a good deal of the time, so the sample is reduced from about ~7,500 to ~1,500, making the theoretical values are quite different.
- some other defaults changed
Previously, the results reflected a situation in the trader would go back in time and cancel their trade when volatility rose. This is an example of look-ahead bias.
- Filter: model
- Filter type: greater than
- Filter value: 20
Means: only count trades taken when the model's current value was greater than 20. If the model is VIX, this might be a common value for equity option short volatility traders.
- removed tnx (which was 10 year yield, not a volatility index... unfortunately, the real 10 year note volatility index, TYVIX, is not updated anymore)
(also, forgot to mention that I changed "window" default to 20, as it is used with HV. HV20 is similar to IV30, as there are about 20 trading days in a calendar month).
- parameters grouped together
이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.