Boxes in left top corn on chart.

Yazzy2589

Yazzy2589

New member
2019 Donor
How could I code this to display in the top left corner of the chart?

MacD- show number in Green if the macD is over 0, red if below?
 
horserider

horserider

Well-known member
VIP
@Yazzy2589 Try this;

Code:
# TD Ameritrade MACD modified to display MACD value and color above/below zeroline. By Horserider 8/18/2019

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;


plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;



AddLabel(yes, "MACD: " + Round(Diff , 2) , if DIFF > ZeroLine then Color.GREEN else Color.RED);
 
Top