OPEN-SOURCE SCRIPT

vol_cone

업데이트됨
Draws a volatility cone on the chart, using the contract's realized volatility (rv). The inputs are:

- window: the number of past periods to use for computing the realized volatility. VIX uses 30 calendar days, which is 21 trading days, so 21 is the default.
- stdevs: the number of standard deviations that the cone will cover.
- periods to project: the length of the volatility cone.
- periods per year: the number of periods in a year. for a daily chart, this is 252. for a thirty minute chart on a contract that trades 23 hours a day, this is 23 * 2 * 252 = 11592. for an accurate cone, this input must be set correctly, according to the chart's time frame.
- history: show the lagged projections. in other words, if the cone is set to project 21 periods in the future, the lines drawn show the top and bottom edges of the cone from 23 periods ago.
- rate: the current interest or discount rate. this is used to compute the forward price of the underlying contract. using an accurate forward price allows you to compare the realized volatility projection to the implied volatility projections derived from options prices.

Example settings for a 30 minute chart of a contract that trades 23 hours per day, with 1 standard deviation, a 21 day rv calculation, and half a day projected:

- stdevs: 1
- periods to project: 23
- window: 23 * 2 * 21 = 966
- periods per year: 23 * 2 * 252 = 11592

Additionally, a table is drawn in the upper right hand corner, with several values:

- rv: the contract's current realized volatility.
- rnk: the rv's percentile rank, compared to the rv values on past bars.
- acc: the proportion of times price settled inside, versus outside, the volatility cone, "periods to project" into the future. this should be around 65-70% for most contracts when the cone is set to 1 standard deviation.
- up: the upper bound of the cone for the projection period.
- dn: the lower bound of the cone for the projection period.

Limitations:

- pinescript only seems to be able to draw a limited distance into the future. If you choose too many "periods to project", the cone will start drawing vertically at some limit.
- the cone is not totally smooth owing to the facts a) it is comprised of a limited number of lines and b) each bar does not represent the same amount of time in pinescript, as some cross weekends, session gaps, etc.
릴리즈 노트
- (hopefully) fixed line re-painting.
- added "lags" input: draw the cone starting from "lags" bars back.
릴리즈 노트
- updated cone to use bar index instead of bar time, which results in a smoother cone that doesn't have problems with gaps.
- added a second cone, for a second standard deviation setting. by default, the first cone is 1 stdev, the second is 2 stdevs.
릴리즈 노트
- updated the table to show the second cone's terminal values.

note that "acc" and "rnk" apply to cone 1 (controlled by stdevs setting) only.
릴리즈 노트
- added "anchor_to_session_start". for intraday charts, this will set the cone on the first bar of the current session (RTH or ETH).

i'm not sure if it works for every time frame. the session must have at least 3 bars. if this setting is checked, "lags" has no effect -- the cones are always lagged to the session start. this setting has no effect on daily or higher timeframes.
forecastHistorical Volatilityivrealizedrvvolatilitycone

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항