tradearcher

Trade Archer - Moving Averages - v1

A group of four moving averages used for price smoothing. It also creates a cloud between Fast Ma and Medfast MA, Medfast MA and Medslow MA, and Medslow MA and Slow MA. Originally only Exponential Moving Averages were available, however the option to choose SMA , EMA (default), RMA, WMA , and VWMA were added. Also added was the option to choose the source of input. If any interesting additions are added, please let me know so I can update the script.
오픈 소스 스크립트

진정한 TradingView의 정신에 따라, 이 스크립트의 작성자는 스크립트를 오픈소스로 게시했기에 거래자들이 이해하고 확인할 수 있습니다. 작가님께 건배! 스크립트를 무료로 사용할 수 있지만, 게시물에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 당신은 스크립트를 차트에 사용하기 위해 그것을 즐겨찾기 할 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?
//Created By User Trade Archer (Kevin Johnson)
//Last Update 1/31/2015
//Added support for SMA, WMA, RMA, and VWMA.  Defaults to EMA
//Note: If you make some neat additions, let me know via PM.  Thanks & Enjoy

study(title="TA-MAs-v1", shorttitle="TA-MAs-v1", overlay=true, precision=2)

//Collect input
source = input(3, type=integer, minval=0, maxval=6, defval=3, title="Source: open=0 high=1 low=2 close=3 hl2=4 hlc3=5 ohlc4=6")
fast = input(9, minval=1, title="Fast MA")
medfast = input(19, minval=1, title="Medfast MA")
medslow = input(50, minval=1, title="Medslow MA")
slow = input(200, minval=1, title="Slow MA")

usesma = input(false, title="SMA", defval=false, type=bool, defval=false)
useema = input(true, title="EMA (default)", defval=true, type=bool, defval=true)
usewma = input(false, title="WMA", defval=false, type=bool, defval=false)
userma = input(false, title="RMA", defval=false, type=bool, defval=false)
usevwma = input(false, title="VWMA", defval=false, type=bool, defval=false)

//Translate source
src = source == 0 ? open :
      source == 1 ? high :
      source == 2 ? low :
      source == 3 ? close :
      source == 4 ? hl2 :
      source == 5 ? hlc3 :
      source == 6 ? ohlc4 :
      close

//Selects check MA type.  Defaults to EMA
ma1 = usesma ? sma( src, fast) : useema ? ema( src, fast) : usewma ? wma( src, fast) : userma ? rma( src, fast) :
      usevwma ? vwma( src, fast) : ema( src, fast)
ma2 = usesma ? sma( src, medfast) : useema ? ema( src, medfast) : usewma ? wma( src, medfast) : userma ? rma( src, medfast) :
      usevwma ? vwma( src, medfast) : ema( src, medfast)
ma3 = usesma ? sma( src, medslow) : useema ? ema( src, medslow) : usewma ? wma( src, medslow) : userma ? rma( src, medslow) :
      usevwma ? vwma( src, medslow) : ema( src, medslow)
ma4 = usesma ? sma( src, slow) : useema ? ema( src, slow) : usewma ? wma( src, slow) : userma ? rma( src, slow) :
      usevwma ? vwma( src, slow) : ema( src, slow)


//plot MAs& save as variable
pfast = plot( ma1, linewidth=1, color=lime, title="Fast MA" )
pmedfast = plot( ma2, linewidth=1, color=orange, title="Medfast MA" )
pmedslow = plot( ma3, linewidth=2, color=red, title="Medslow MA" )
pslow = plot( ma4, linewidth=3, color=maroon, title="Slow MA" )

//fill between two emas
fquickcloud = fill(pfast, pmedfast, color=green, transp=65, title="Quick Cloud")
fnormalcloud = fill(pmedfast, pmedslow, color=yellow, transp=75, title="Normal Cloud")
fslowcloud = fill(pmedslow, pslow, color=red, transp=85, title="Slow Cloud")