Modify DMI indicator to display as a label?

FOTM_8888

Member
VIP
Hi i will like to plot a lower square or dot on the charts, the way it is now is just a label, how can i create a lower dot or square? thank you in advance.

Code:
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"));
 
Last edited by a moderator:

MerryDay

Well-known member
VIP
Hxdf3XB.png


Code:
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"));

plot DIp_greater =  if ADX > 20 and DIp > Dim then low else double.NaN ;
plot DIm_greater =  if ADX > 20 and DIm > DIp then high else double.NaN ;

DIp_greater.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
DIp_greater.SetLineWeight(1);
DIp_greater.SetDefaultColor(color.dark_green) ;

DIm_greater.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
DIm_greater.SetLineWeight(1);
DIm_greater.SetDefaultColor(color.dark_red) ;
 

Similar threads

Top