ADX chart label into lower study


Category:
0
0

Pete

Hope you can help turn my chart label into lower study…..If label would be green..make a green dot on the row…same for red/grey labels…

 

input length = 14;
input averageType = AverageType.WILDERS;

DefineGlobalColor(“DI+”, color.green);
DefineGlobalColor(“DI-“, color.red);
DefineGlobalColor(“Neutral”, color.gray);

def ADX = DMI(length, averageType).ADX;
def DIp = DMI(length, averageType).”DI+”;
def DIm = DMI(length, averageType).”DI-“;
AddLabel(Yes, “ADX(“+length+”):” + Round(ADX,1), if ADX > 20 and DIp > Dim then GlobalColor(“DI+”) else if ADX > 20 and DIm > DIp then GlobalColor(“DI-“) else GlobalColor(“Neutral”));

Marked as spam
Posted by (Questions: 49, Answers: 42)
Asked on April 6, 2021 3:03 pm
81 views
0
Private answer

I think this should do the trick. I only had to copy the if/then/else statement from the section of the AddLabel statement that controls the color of the label. I have only tested this for errors and did not check it for accuracy.

input length = 14;
input averageType = AverageType.WILDERS;
DefineGlobalColor(“DI+”, color.green);
DefineGlobalColor(“DI-“, color.red);
DefineGlobalColor(“Neutral”, color.gray);
def ADX = DMI(length, averageType).ADX;
def DIp = DMI(length, averageType).”DI+”;
def DIm = DMI(length, averageType).”DI-“;
plot row = if !IsNaN(close) then 0 else Double.NaN;
row.AssignValueColor(if ADX > 20 and DIp > Dim then GlobalColor(“DI+”) else if ADX > 20 and DIm > DIp then GlobalColor(“DI-“) else GlobalColor(“Neutral”));
row.SetPaintingStrategy(PaintingStrategy.POINTS);
row.SetLineWeight(3);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 6, 2021 4:16 pm