주요 이동 평균 기능을 하나의 지표안에 모두 넣었습니다. 이 지표 하나로 모든 이동 평균을 쓸 수 있습니다
디폴트로 현재 차트 타임프레임 적용 크거나 작은 타임프레임을 쓸 수 있는 체크박스 트렌드에 따른 MA 색상과 단일 색상 토글 스위치 체크박스 컬러 스무딩을 위한 인풋 *** 2차 이동 평균 그리는 기능 2번째 이평은 완전히 다른 타입 MA 를 쓸 수 있음. 2번째 이평 색상도 별도로 콘트롤 가능 이평 크로스 플롯 기능 - 2차 이평이 안 그려져도 가능
아래 코멘트에 소스를 넣어 놓았으니 Pine Script 코드 스터디에 도움이 되기를...
הערה
⋅
//Created by user ChrisMoody 4-24-2014 //Plots The Majority of Moving Averages //Defaults to Current Chart Time Frame --- But Can Be Changed to Higher Or Lower Time Frames //2nd MA Capability with Show Crosses Feature study(title="CM_Ultimate_MA_MTF", shorttitle="CM_Ultimate_MA_MTF", overlay=true) //inputs src = close useCurrentRes = input(true, title="Use Current Chart Resolution?") resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="D") len = input(20, title="Moving Average Length - LookBack Period") atype = input(1,minval=1,maxval=7,title="1=SMA, 2=EMA, 3=WMA, 4=HullMA, 5=VWMA, 6=RMA, 7=TEMA") cc = input(true,title="Change Color Based On Direction?") smoothe = input(2, minval=1, maxval=10, title="Color Smoothing - 1 = No Smoothing") doma2 = input(false, title="Optional 2nd Moving Average") len2 = input(50, title="Moving Average Length - Optional 2nd MA") atype2 = input(1,minval=1,maxval=7,title="1=SMA, 2=EMA, 3=WMA, 4=HullMA, 5=VWMA, 6=RMA, 7=TEMA") cc2 = input(true,title="Change Color Based On Direction 2nd MA?") warn = input(false, title="***You Can Turn On The Show Dots Parameter Below Without Plotting 2nd MA to See Crosses***") warn2 = input(false, title="***If Using Cross Feature W/O Plotting 2ndMA - Make Sure 2ndMA Parameters are Set Correctly***") sd = input(false, title="Show Dots on Cross of Both MA's")
res = useCurrentRes ? period : resCustom //hull ma definition hullma = wma(2*wma(src, len/2)-wma(src, len), round(sqrt(len))) //TEMA definition ema1 = ema(src, len) ema2 = ema(ema1, len) ema3 = ema(ema2, len) tema = 3 * (ema1 - ema2) + ema3