ThinkScript 'return' equivalent

J

jrob0124

New member
Does ThinkScript have an equivalent to the keyword 'return' or 'break'? If not, maybe some can help me. I have an if\else statement, that I would like the else statement to do nothing. Here is a sample of the code. I am plotting sup\res lines based off a stock symbol, however, when I view a stock not defined in the code, I would like the study to plot nothing. Any help would be greatly appreciated.

Code:
def KeyLevel;
def Support01;
def Support02;
def Resistence01;
def Resistence02;

if (GetSymbol() == "AAPL") then {
    KeyLevel = 382.75;
    Support01 = 381.5;
    Support02 = 378.75;
    Resistence01 = 384.75;
    Resistence02 = 386.5;
} else {
    KeyLevel = 0;
    Support01 = 0;
    Support02 = 0;
    Resistence01 = 0;
    Resistence02 = 0;

}

plot Sup01 = Support01;Sup01.SetDefaultColor(Color.GRAY);Sup01.setStyle(Curve.LONG_DASH);Sup01.HideBubble();
plot Sup02 = Support02;Sup02.SetDefaultColor(Color.GRAY);Sup02.setStyle(Curve.LONG_DASH);Sup02.HideBubble();
plot Key = KeyLevel;Key.SetDefaultColor(Color.RED);Key.setStyle(Curve.LONG_DASH);Key.HideBubble();
plot Res01 = Resistence01;Res01.SetDefaultColor(Color.GRAY);Res01.setStyle(Curve.LONG_DASH);Res01.HideBubble();
plot Res02 = Resistence02;Res02.SetDefaultColor(Color.GRAY);Res02.setStyle(Curve.LONG_DASH);Res02.HideBubble();
 
J

jrob0124

New member
@Pensar That is exactly what I was looking for, thank you!
 

Similar threads

Top