Add MTF to MACD Divergence?

T

Trading51

Member
2019 Donor
Warehouse
Need this for MTF could I get some help

Code:
# MACDDIVERGENCE_R1V1
# R1V1   2011.05.14:22:15 - TONY LIPTON
#        monitors macd divergenge for entry

#        MAJOR CODE CONTRIBUTION by KumoBob aka Bob Campbell
#        http://fibonacci-financial.blogspot.com/

INPUT VFL = 12;
INPUT VSL = 26;

DEF VLB = VFL + VSL;

DEF vh34 = highest(MACDHistogram(VFL,VSL),VLB);
DEF vl34 = lowest(MACDHistogram(VFL,VSL),VLB);

input ChartBubblesON = NO;
input LinesON = Yes;

rec top;
rec bot;

top = if
MACDHistogram(VFL,VSL) == VH34
then High  else top[1];
bot = if
MACDHistogram(VFL,VSL) == VL34
then Low  else bot[1];

plot topline = if !LinesOn then Double.NaN else top;
topline.SetLineWeight(1);
topline.assignValueColor(if ((top < HIGH)) then color.DOWNTICK  else color.gray);
topline.SetPaintingStrategy(PaintingStrategy.points);
plot bottomline =  if !LinesOn then Double.NaN else bot;
bottomline.SetLineWeight(1);
bottomline.assignValueColor(if ((LOW < bot)) then color.UPTICK else color.gray);
bottomline.SetPaintingStrategy(PaintingStrategy.dashes);
#
 
Last edited by a moderator:
markos

markos

Well-known member
VIP
Please don't take this the wrong way, however, my belief is that you are ruining and misusing a perfectly good indicator by making it try to give you multiple deviations. If you are looking at it on a daily chart, and you switch to weekly chart, the new deviation if there is one is what you would have. There is no need to change the numbers on a MACD.
If someone else wants to ruin a perfectly good indicator, they are welcome to, but I would advise against it.
 
T

Trading51

Member
2019 Donor
Warehouse
That’s the thing with trading we all have our own style that works great
 

Top