16400 SPAIN
Posts: 14 since Jun 2019
Thanks Given: 30
Thanks Received: 8
|
Hello!
Could someone explain me how the color coding works in the labels of this script?
# ADVANCE-DECLINE LABEL
def ADSPD = close ("$ADSPD");
def percentAD = Round(100 * ((ADSPD) / 500), 1);
# LABEL COLOR
def Red_w1 = slope > 0 and percentAD < percentAD[1];
def Red_s1 = slope < 0 and percentAD < percentAD[1];
def Green_w1 = slope < 0 and percentAD > percentAD[1];
def Green_s1 = slope > 0 and percentAD > percentAD[1];
def gray1 = slope == 0 or percentAD == percentAD[1];
AddLabel(yes, "AD: " + percentAD + "%", if Red_w1 then CreateColor(222, 81, 93) else if
Red_s1 then Color.RED else if Green_w1 then CreateColor(0, 139, 139) else if Green_s1 then
CreateColor(2, 217, 218) else if gray1 then Color.GRAY else Color.BLACK);
Thanks!!
|