With the attached coding, the colorbar1 switches with the crossover of
PDI() and MDI(). Here is what I am trying to achieve...
When the PDI()>MDI() and the gap between the two is greater today than
yesterday than use colorgreen in colorbar1...otherwise, use colorred
in colorbar1 for that day.
When the MDI()>PDI()and the gap between the two is greater today than
yesterday than use colorred in colorbar1...otherwise, use colorgreen
in colorbar1 for that day.
I have tried a number of different ways but have been unsuccessful.
Any help will be greatly appreciated!
range = Param("Periods", 14, 2, 200, 1 );
Plot( ADX(range), _DEFAULT_NAME(), ParamColor( "ADX color", colorBlue
), ParamStyle("ADX style", styleThick ) );
Plot( PDI(range), "+DI", ParamColor( "+DI color", colorGreen ),
ParamStyle("+DI style") );
Plot( MDI(range), "-DI", ParamColor( "-DI color", colorRed ),
ParamStyle("-DI style") );
V1=PDI();
V2=MDI();
V3=V1-V2; //diff when PDI>MDI...
V4=V2-V1; //diff when MDI>PDI...
ColorBar1 = IIf(V1 > V2,colorGreen,colorRed);