HPotter

MACD Crossover

MACD – Moving Average Convergence Divergence. The MACD is calculated
by subtracting a 26-day moving average of a security's price from a
12-day moving average of its price. The result is an indicator that
oscillates above and below zero. When the MACD is above zero, it means
the 12-day moving average is higher than the 26-day moving average.
This is bullish as it shows that current expectations (i.e., the 12-day
moving average) are more bullish than previous expectations (i.e., the
26-day average). This implies a bullish, or upward, shift in the supply/demand
lines. When the MACD falls below zero, it means that the 12-day moving average
is less than the 26-day moving average, implying a bearish shift in the
supply/demand lines.
A 9-day moving average of the MACD (not of the security's price) is usually
plotted on top of the MACD indicator. This line is referred to as the "signal"
line. The signal line anticipates the convergence of the two moving averages
(i.e., the movement of the MACD toward the zero line).
Let's consider the rational behind this technique. The MACD is the difference
between two moving averages of price. When the shorter-term moving average rises
above the longer-term moving average (i.e., the MACD rises above zero), it means
that investor expectations are becoming more bullish (i.e., there has been an
upward shift in the supply/demand lines). By plotting a 9-day moving average of
the MACD, we can see the changing of expectations (i.e., the shifting of the
supply/demand lines) as they occur.

오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

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

차트에 이 스크립트를 사용하시겠습니까?
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 18/06/2014
// MACD – Moving Average Convergence Divergence. The MACD is calculated 
// by subtracting a 26-day moving average of a security's price from a 
// 12-day moving average of its price. The result is an indicator that 
// oscillates above and below zero. When the MACD is above zero, it means 
// the 12-day moving average is higher than the 26-day moving average. 
// This is bullish as it shows that current expectations (i.e., the 12-day 
// moving average) are more bullish than previous expectations (i.e., the 
// 26-day average). This implies a bullish, or upward, shift in the supply/demand 
// lines. When the MACD falls below zero, it means that the 12-day moving average 
// is less than the 26-day moving average, implying a bearish shift in the 
// supply/demand lines.
// A 9-day moving average of the MACD (not of the security's price) is usually 
// plotted on top of the MACD indicator. This line is referred to as the "signal" 
// line. The signal line anticipates the convergence of the two moving averages 
// (i.e., the movement of the MACD toward the zero line).
// Let's consider the rational behind this technique. The MACD is the difference 
// between two moving averages of price. When the shorter-term moving average rises 
// above the longer-term moving average (i.e., the MACD rises above zero), it means 
// that investor expectations are becoming more bullish (i.e., there has been an 
// upward shift in the supply/demand lines). By plotting a 9-day moving average of 
// the MACD, we can see the changing of expectations (i.e., the shifting of the 
// supply/demand lines) as they occur.
////////////////////////////////////////////////////////////
study(title="MACD Crossover", shorttitle="MACD Crossover")
fastLength = input(8, minval=1)
slowLength = input(16,minval=1)
signalLength=input(11,minval=1)
hline(0, color=purple, linestyle=dashed)
fastMA = ema(close, fastLength)
slowMA = ema(close, slowLength)
macd = fastMA - slowMA
signal = sma(macd, signalLength)
pos = iff(signal < macd , 1,
	    iff(signal > macd, -1, nz(pos[1], 0))) 
barcolor(pos == -1 ? red: pos == 1 ? green : blue)
plot(signal, color=red, title="SIGNAL")
plot(macd, color=blue, title="MACD")