CrackingCryptocurrency

MovingAveragesLibrary

Library "MovingAveragesLibrary"
This is a library allowing one to select between many different Moving Average formulas to smooth out any float variable.

You can use this library to apply a Moving Average function to any series of data as long as your source is a float.

The default application would be for applying Moving Averages onto your chart. However, the scope of this library is beyond that. Any indicator or strategy you are building can benefit from this library.

You can apply different types of smoothing and moving average functions to your indicators, momentum oscillators, average true range calculations, support and resistance zones, envelope bands, channels, and anything you can think of to attempt to smooth out noise while finding a delicate balance against lag.

If you are developing an indicator, you can use the 'ave_func' to allow your users to select any Moving Average for any function or variable by creating an input string with the following structure:

var_name = input.string(<title>, <defval>, <options>)

Where the types of Moving Average you would like to be provided would be included in options.

Example:

i_ma_type = input.string(title = "Moving Average Type", defval = "Hull Moving Average", options = )

Where you would add after options the strings I have included for you at the top of the PineScript for your convenience.

Then for the output you desire, simply call 'ave_func' like so:

ma = ave_func(source, length, i_ma_type)

Now the plotted Moving Average will be the same as what you or your users select from the Input.

ema(src, len ) Exponential Moving Average .
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: Float value.

sma(src, len ) Simple Moving Average .
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: Float value.

rma(src, len ) Relative Moving Average.
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: Float value.

wma(src, len ) Weighted Moving Average .
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: Float value.

dv2( len ) Donchian V2 function.
  Parameters:
    len: Lookback length to use.
  Returns: Open + Close / 2 for the selected length.

ModFilt(src, len ) Modular Filter smoothing function.
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: Float value.

EDSMA(src, len ) Ehlers Dynamic Smoothed Moving Average .
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: EDSMA smoothing.

dema(x, t) Double Exponential Moving Average .
  Parameters:
    x: Series to use ('close' is used if no argument is supplied).
    t: Lookback length to use.
  Returns: DEMA smoothing.

tema(src, len ) Triple Exponential Moving Average .
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: TEMA smoothing.

smma(x, t) Smoothed Moving Average .
  Parameters:
    x: Series to use ('close' is used if no argument is supplied).
    t: Lookback length to use.
  Returns: SMMA smoothing.

vwma(x, t) Volume Weighted Moving Average .
  Parameters:
    x: Series to use ('close' is used if no argument is supplied).
    t: Lookback length to use.
  Returns: VWMA smoothing.

hullma(x, t) Hull Moving Average .
  Parameters:
    x: Series to use ('close' is used if no argument is supplied).
    t: Lookback length to use.
  Returns: Hull smoothing.

covwma(x, t) Coefficient of Variation Weighted Moving Average .
  Parameters:
    x: Series to use ('close' is used if no argument is supplied).
    t: Lookback length to use.
  Returns: COVWMA smoothing.

frama(x, t) Fractal Reactive Moving Average.
  Parameters:
    x: Series to use ('close' is used if no argument is supplied).
    t: Lookback length to use.
  Returns: FRAMA smoothing.

kama(x, t) Kaufman's Adaptive Moving Average .
  Parameters:
    x: Series to use ('close' is used if no argument is supplied).
    t: Lookback length to use.
  Returns: KAMA smoothing.

donchian( len ) Donchian Calculation.
  Parameters:
    len: Lookback length to use.
  Returns: Average of the highest price and the lowest price for the specified look-back period.

tma(src, len ) Triangular Moving Average.
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: TMA smoothing.

VAMA(src, len ) Volatility Adjusted Moving Average.
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: VAMA smoothing.

Jurik(src, len ) Jurik Moving Average.
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: JMA smoothing.

MCG(src, len ) McGinley smoothing.
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: McGinley smoothing.

zlema(series, length) Zero Lag Exponential Moving Average .
  Parameters:
    series: Series to use ('close' is used if no argument is supplied).
    length: Lookback length to use.
  Returns: ZLEMA smoothing.

xema(src, len ) Optimized Exponential Moving Average .
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    len: Lookback length to use.
  Returns: XEMA smoothing.

EhlersSuperSmoother(src, lower) Ehlers Super Smoother.
  Parameters:
    src: Series to use ('close' is used if no argument is supplied).
    lower: Smoothing value to use.
  Returns: Ehlers Super smoothing.

EhlersEmaSmoother( sig , smoothK, smoothP) Ehlers EMA Smoother.
  Parameters:
    sig: Series to use ('close' is used if no argument is supplied).
    smoothK: Lookback length to use.
    smoothP: Smothing value to use.
  Returns: Ehlers EMA smoothing.

ave_func(in_src, in_len, in_type) Returns the source after running it through a Moving Average function.
  Parameters:
    in_src: Series to use ('close' is used if no argument is supplied).
    in_len: Lookback period to be used for the Moving Average function.
    in_type: Type of Moving Average function to use. Must have a string input to select the options from that MUST match the type-casing in the function below.
  Returns: The source as a float after running it through the Moving Average function.

https://Premium.CrackingCryptocurrency.Com
Professional Mentors & Community for an evolving marketplace.
Proprietary Indicators and Strategies - Pathways to Profit Course.
Transparency & Honesty - Join our Free Community Today!
파인 라이브러리

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

면책사항

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

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

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