This script guages the probability of an underlying moving a certain amount on expiration day, to aid the popular "0 dte" strategy. The script counts how many next-day moves exceeded a given magnitude in the past, under similar conditions. The inputs are:

- "open": measures the magnitude as "open to close"--a true 0 dte .
- "previous close": for lazy people who don't want to wake up early. measures magnitude from the previous day's close.

- "percent": measures moves that exceed a given percentage.
- "absolute": measures moves that exceed a point value.

move-dir: measure only up moves, down moves, or both.
vol_model: the model for realized volatility . (may add more later).
min_vol: only measure moves when realized vol is above this value.
max_vol: only measure moves when realized vol is below this value.
precision: number of digits printed in the output table.


- mark_mode: "previous close"
- move_mode: "percent"
- move_dir: "up"
- move_mag: 0.07
- vol_model: hv30
- min_vol: 0.2
- max_vol: 0.5

These settings will count the number of trading days that closed 7% higher than the previous day's close, when the previous day's realized volatility (annualized) was between 20% and 50%. The outputs are:

- current vol: green plot. Today's realized vol. Shown for convenience.
- max and min vol: red plots. Also shown for convenience.
- count: the number of days that exceeded the chosen magnitude, when the previous day's realized volatility was within the chosen bounds.
- total: the total number of days where realized volatility was within the chosen bounds
- probability: count / total. the percentage of days that exceeded the move when volatility was within the bounds.
- move: plotted as a purple line. purple "X" labels are plotted above
- bars where the move exceeded the magnitude threshold and volatility was in-bounds. a "hit".


This script is based on the idea that realized volatility has some bearing on future volatility . By seeing what happened in the past when volatility was close to its current value, we may be able to assess the probability that our short put will be in the money, tomorrow, and our account devastated.

NOTE: Unlike many of my other scripts, all percentages--both inputs and outputs--are given in fractional form. E.g., 0.01 means 1%.
릴리즈 노트: - annualize volatility with 252, rather than 365 trading periods
- fixed misnamed condition
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.


이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

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