Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- study("Simple 17 Indicator BF", overlay=true)
- ///////////// Moving Average /////////////
- source = input(title="MA Source", defval=ohlc4)
- maType = input(title="MA Type", defval="sma", options=["sma", "ema", "swma", "wma", "vwma", "rma"])
- length = input(title="MA Length", defval=17)
- ///////////// Get MA Function by bennef /////////////
- getMAType(maType, sourceType, maLen) =>
- res = sma(close, 1)
- if maType == "ema"
- res := ema(sourceType, maLen)
- if maType == "sma"
- res := sma(sourceType, maLen)
- if maType == "swma"
- res := swma(sourceType)
- if maType == "wma"
- res := wma(sourceType, maLen)
- if maType == "vwma"
- res := vwma(sourceType, maLen)
- if maType == "rma"
- res := rma(sourceType, maLen)
- res
- MA = getMAType(maType, source, length)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement