Electrified

Volatility

Electrified 업데이트됨   
Library "Volatility"
Functions for determining if volatility (true range) is within or exceeds normal.
The "True Range" (ta.tr) is used for measuring volatility.
Values are normalized by the volume adjusted weighted moving average (VAWMA) to be more like percent moves than price.

current(len) Returns the current price adjusted volatitlity ratio.
  Parameters:
    len: Number of bars to get a volume adjusted weighted average price.

normal(len, maxDeviation, level, gapDays, spec, res) Returns the normal upper range of volatility. Compensates for overnight gaps within a regular session.
  Parameters:
    len: Number of bars to measure volatility.
    maxDeviation: The limit of volatility before considered an outlier.
    level: The amount of standard deviation after cleaning outliers to be considered within normal.
    gapDays: The number of days in the past to measure overnight gap volaility.
    spec: session.regular (default), session.extended or other time spec.
    res: The resolution (default = '1440').

isNormal(len, maxDeviation, level, gapDays, spec, res) Returns true if the volatility (true range) is within normal levels. Compensates for overnight gaps within a regular session.
  Parameters:
    len: Number of bars to measure volatility.
    maxDeviation: The limit of volatility before considered an outlier.
    level: The amount of standard deviation after cleaning outliers to be considered within normal.
    gapDays: The number of days in the past to measure overnight gap volaility.
    spec: session.regular (default), session.extended or other time spec.
    res: The resolution (default = '1440').

severity(len, maxDeviation, level, gapDays, spec, res) Returns ratio of the current value to the normal value. Compensates for overnight gaps within a regular session.
  Parameters:
    len: Number of bars to measure volatility.
    maxDeviation: The limit of volatility before considered an outlier.
    level: The amount of standard deviation after cleaning outliers to be considered within normal.
    gapDays: The number of days in the past to measure overnight gap volaility.
    spec: session.regular (default), session.extended or other time spec.
    res: The resolution (default = '1440').
릴리즈 노트:
v2 Attempt to improve performance and reduce dependencies.
릴리즈 노트:
v3 Improved performance by exposing gap level to caller if needed. Opened up ability to use a different volatility value.

Added:
normalWithGap(len, maxDeviation, level, gapDays, spec, res, volatility) Returns the normal upper range of volatility and the normal gap value.
  Parameters:
    len: Number of bars to measure volatility.
    maxDeviation: The limit of volatility before considered an outlier.
    level: The amount of standard deviation after cleaning outliers to be considered within normal.
    gapDays: The number of days in the past to measure overnight gap volaility.
    spec: session.regular (default), session.extended or other time spec.
    res: The resolution (default = '1440').
    volatility: The value to use as a volatility measure. Default is (ta.tr) the "True Range".
  Returns:

Updated:
normal(len, maxDeviation, level, gapDays, spec, res, volatility) Returns the normal upper range of volatility. Compensates for overnight gaps within a regular session.
  Parameters:
    len: Number of bars to measure volatility.
    maxDeviation: The limit of volatility before considered an outlier.
    level: The amount of standard deviation after cleaning outliers to be considered within normal.
    gapDays: The number of days in the past to measure overnight gap volaility.
    spec: session.regular (default), session.extended or other time spec.
    res: The resolution (default = '1440').
    volatility: The value to use as a volatility measure. Default is (ta.tr) the "True Range".

isNormal(len, maxDeviation, level, gapDays, spec, res, volatility) Returns true if the volatility (true range) is within normal levels. Compensates for overnight gaps within a regular session.
  Parameters:
    len: Number of bars to measure volatility.
    maxDeviation: The limit of volatility before considered an outlier.
    level: The amount of standard deviation after cleaning outliers to be considered within normal.
    gapDays: The number of days in the past to measure overnight gap volaility.
    spec: session.regular (default), session.extended or other time spec.
    res: The resolution (default = '1440').
    volatility: The value to use as a volatility measure. Default is (ta.tr) the "True Range".

severity(len, maxDeviation, level, gapDays, spec, res, volatility) Returns ratio of the current value to the normal value. Compensates for overnight gaps within a regular session.
  Parameters:
    len: Number of bars to measure volatility.
    maxDeviation: The limit of volatility before considered an outlier.
    level: The amount of standard deviation after cleaning outliers to be considered within normal.
    gapDays: The number of days in the past to measure overnight gap volaility.
    spec: session.regular (default), session.extended or other time spec.
    res: The resolution (default = '1440').
    volatility: The value to use as a volatility measure. Default is (ta.tr) the "True Range".

Removed:
current(len) Returns the current price adjusted volatitlity ratio.
릴리즈 노트:
v4 Improved use of data cleaning and gap detection.
릴리즈 노트:
v5 Improved defaults.
릴리즈 노트:
v6
  • Added specialized "calcTrueRange" for more than one bar.
  • Added "fromTrueRange" to provide a more useful UDT (Volatility) for understanding the current volatility.
릴리즈 노트:
v7 Upgraded true range calc.

Updated:
fromTrueRange(len, maxDev, span, quantized, useWma, smoothing)
  Calculates the volatility based upon the true range.
  Parameters:
    len: maxDev deviation before considered an outlier.
    maxDev
    span: Number of bars measure the true range.
    quantized: When true, the true range is calculated once for every span. When false (default), the true range is calulated for the span on every bar.
    useWma: When true, the calulcation is done using an improved weighted moving average to avoid giving significance to older values.
    smoothing: The number of extra bars to help in smoothing out the result so that large spikes dont' occur from recent data.
파인 라이브러리

트레이딩뷰 정신에 따라 오써는 이 파인 코드를 오픈 소스 라이브러리로 퍼블리쉬하여 당사 커뮤니티의 다른 파인 프로그래머들이 쓸 수 있도록 하였습니다. 오써에게 찬사를! 여러분은 이 라이브러리를 프라이빗 또는 오픈 소스 퍼블리케이션에 쓸 수 있지만 퍼블리케이션에 재사용은 하우스룰을 따릅니다.

면책사항

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

이 라이브러리를 쓰시겠습니까?

텍스트를 클립보드에 카피한 뒤 님의 스크립트에 붙여 넣기.