if showperc {
def percValRounded = Round(PercVal, 2);
def labelId;
if !IsNaN(PercVal) {
labelId = CreateLabel(AsPercent(percValRounded), TextAlignment.ABOVE_BAR);
} else {
labelId = Double.NaN;
}
if !IsNaN(labelId) {
SetColor(labelId, Color.WHITE);
} else {
SetLabelTextColor(labelId, if PercVal >= 0 then Color.LIME else Color.ORANGE);}
};
# Buy and sell signals
def goodlong = long and buyprice <= sellprice;
def goodshort = short and sellprice > buyprice;
def txtlight_b = Color.LIME; # Buy signal set to always green.
def txtlight_s = if goodshort then Color.RED else Color.YELLOW;
This is part of the code I'm having problems with. If I omit the semicolon at the end of the braces, then the next line (def goodlong = long and buyprice <= sellprice
shows red and the first if and final brace are red. If I put a semicolon after the brace, like it shows above, I no longer get the error in the "def goodlong" line but still get the red on the if and final brace. Any help would be appreciated.
def percValRounded = Round(PercVal, 2);
def labelId;
if !IsNaN(PercVal) {
labelId = CreateLabel(AsPercent(percValRounded), TextAlignment.ABOVE_BAR);
} else {
labelId = Double.NaN;
}
if !IsNaN(labelId) {
SetColor(labelId, Color.WHITE);
} else {
SetLabelTextColor(labelId, if PercVal >= 0 then Color.LIME else Color.ORANGE);}
};
# Buy and sell signals
def goodlong = long and buyprice <= sellprice;
def goodshort = short and sellprice > buyprice;
def txtlight_b = Color.LIME; # Buy signal set to always green.
def txtlight_s = if goodshort then Color.RED else Color.YELLOW;
This is part of the code I'm having problems with. If I omit the semicolon at the end of the braces, then the next line (def goodlong = long and buyprice <= sellprice