ehaerim

[번] MACD 커스텀 인디케이터 - 멀티플 타임 프레임 + 여러가지 옵션이 가능합니다!

NASDAQ:GOOG   Alphabet Inc (Google) Classe C
MACD 에는 다음과 같은 기능이 들어 있습니다:
  • 다른 타임프레임을 볼 수 있음
  • 자동으로 차트 타임프레임에 맞춰 적용
  • 더 크거나 작은 타임프레임으로 바꿀 수 있음
  • MACD 가 시그널 라인을 크로스할 때 MACD 라인 색깔을 바꿀 수 있게 해 주는 체크박스
  • MACD 에서 점으로 보여주기 - 시그널 라인 크로스
  • 차트에서 히스토그램을 없앨 수 있는 체크박스
  • 히스토그램 색을 4색에서 1색 (디폴트 회색) 으로 바꿀 수 있는 체크박스

커스텀 인디케이터 임포트하는 비디오:
blog.tradingview.com/?p=265

인디케이터 코드 링크:
pastebin.com/P9Ru20mb

*** 지표 소스 코드 ***
//크리스 무디 작성, 2014년 10월 4일 업데이트함
//제로라인 기준 위/아래 방향에 따라 4가지 색으로 막대그래프를 그려주는 일반 MACD 지표
study(title="CM_MacD_Ult_MTF", shorttitle="CM_Ult_MacD_MTF")
source = close
useCurrentRes = input(true, title="Use Current Chart Resolution?")
resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="60")
smd = input(true, title="Show MacD & Signal Line? Also Turn Off Dots Below")
s d = input(true, title="Show Dots When MacD Crosses Signal Line?")
sh = input(true, title="Show Histogram?")
macd_colorChange = input(true,title="Change MacD Line Color-Signal Line Cross?")
hist_colorChange = input(true,title="MacD Histogram 4 Colors?")

res = useCurrentRes ? period : resCustom

fastLength = input(12, minval=1), slowLength=input(26,minval=1)
signalLength=input(9,minval=1)

fastMA = ema(source, fastLength)
slowMA = ema(source, slowLength)

macd = fastMA - slowMA
signal = sma(macd, signalLength)
hist = macd - signal

outMacD = security(tickerid, res, macd)
outSignal = security(tickerid, res, signal)
outHist = security(tickerid, res, hist)

histA_IsUp = outHist > outHist and outHist > 0
histA_IsDown = outHist < outHist and outHist > 0
histB_IsDown = outHist < outHist and outHist <= 0
histB_IsUp = outHist > outHist and outHist <= 0

//MacD Color Definitions
macd_IsAbove = outMacD >= outSignal
macd_IsBelow = outMacD < outSignal

plot_color = hist_colorChange ? histA_IsUp ? aqua : histA_IsDown ? blue : histB_IsDown ? red : histB_IsUp ? maroon :yellow :gray
macd_color = macd_colorChange ? macd_IsAbove ? lime : red : red
signal_color = macd_colorChange ? macd_IsAbove ? yellow : yellow : lime

circleYPosition = outSignal

plot(smd and outMacD ? outMacD : na, title="MACD", color=macd_color, linewidth=4)
plot(smd and outSignal ? outSignal : na, title="Signal Line", color=signal_color, style=line ,linewidth=2)
plot(sh and outHist ? outHist : na, title="Histogram", color=plot_color, style=histogram, linewidth=4)
plot(s d and cross(outMacD, outSignal) ? circleYPosition : na, title="Cross", style=circles, linewidth=4, color=macd_color)
hline(0, '0 Line', linestyle=solid, linewidth=2, color=white)

HaeRim Lee
TradingView Korea Service Manager (kr.tradingview.com)
MultiCharts Korea Service Provider (www.investware.net)
TView: ehaerim
Skype: ehaerim
Kakao: ehaerim
Mobile: +82-10-4035-2873
Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.