MacD Custom Indicator-Multiple Time Frame+All Available Options!

This MacD Indicator has every feature available. See First Post for Details.
즐겨찾기 스크립트에서 빼기 즐겨찾기 스크립트에 넣기
//Created by user ChrisMoody updated 4-10-2014
//Regular MACD Indicator with Histogram that plots 4 Colors Based on Direction Above and Below the Zero Line
//Update allows Check Box Options, Show MacD & Signal Line, Show Change In color of MacD Line based on cross of Signal Line.
//Show Dots at Cross of MacD and Signal Line, Histogram can show 4 colors or 1, Turn on and off Histogram.
//Special Thanks to that incredible person in Tech Support whoem I won't say you r name so you don't get bombarded with emails
//Note the feature Tech Support showed me on how to set the default timeframe of the indicator to the chart Timeframe, but also allow you to choose a different timeframe.
//By the way I fully disclose that I completely STOLE the Dots at the MAcd Cross from "TheLark"

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")
sd = 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)

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[1] and outHist > 0
histA_IsDown = outHist < outHist[1] and outHist > 0
histB_IsDown = outHist < outHist[1] and outHist <= 0
histB_IsUp = outHist > outHist[1] 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(sd 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)
where is the first post ?!
+9 응답
no repaint strategy ->->-> MOEX:SBER No repaint 10M/5M DEMO! Without 2 weeks
can you make it display all the macd time frames in one chart regardless of what timeframe you're in? i'm having an awful time making that work. trading view keeps throwing invalid resolution (1800) in the security argument error because i'm using multiplication.

so if you're in 1 min chart, it should allow you to display 1, 3, 5, 15, 30 min macds as well as 1 hr, 2hr, 3hr, 4hr macd and then 1d and 1wk macds, or any combination there of.

usually having more than 5 macds slows it down. so it would be nice to have macds from 1 min, 10 min, 30 min, 1hr, and 4 hr and so on on one chart. how do i do that? please help me it's driving me crazy.
Still unable to find the first post
+5 응답
Great script, very useful. Thanks chris
+1 응답
Hi there, is it possible to add Highs and Lows (Close) in Chart with a H/L when there is a trigger of Signal/MACD Line? That would be nice to use the MTF feature more practically. :)
Could you please test this strategy

+19 응답
@ChrisMoody - Hi Chris, nice work but I wanted to know if there is any reason why you left out the Divergence and Convergence?
+14 응답
Seems like you're using SMA instead of EMA for the signal line of the MACD
홈으로 스탁 스크리너 포렉스 스크리너 크립토 스크리너 이코노믹 캘린더 사용안내 차트 특징 프라이싱 하우스룰(내부규정) 모더레이터 웹사이트 & 브로커 솔루션 위젯 차팅 솔루션 도움 받기 기능 개발/개선 요청 블로그 & 뉴스 잦은물음 위키 트위터
프로화일 프로화일설정 계정 및 빌링 트레이딩뷰 코인 나의 서포트 티켓 도움 받기 공개아이디어 팔로어 팔로잉 비밀메시지 채팅 로그아웃