Sorry for the late response, but I just wanted to let you know the if expression will always evaluate what's true AND what's false, the if statement does not.
This was pulled directly from the learning center:
https://tlc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/if
As a reserved word, if is used in if-expressions and if-statements to specify a conditional operator with then and else branches. Both branches are required for the operator to be valid. However, while the if-expression always calculates both then and else branches, the if-statement only calculates the branch defined by whether the condition is true or false. In thinkScript®, there is also an
If-function with a different syntax and usage.
Syntax (if-expression)
plot <plot_name> = if <condition>
then <expression1>
else <expression2>;
plot <plot_name> = if <condition1>
then <expression1>
else if <condition2>
then <expression2>
else <expression3>;
Syntax (if-statement)
plot <plot_name>;
if <condition1> [then] {
<plot_name> = <expression1>;
} else if <condition2> [then] {
<plot_name> = <expression2>;
} else {
<plot_name> = <expression3>;
}
plot <plot_name>;
if <condition1> [then] {
<plot_name > = <expression1>;
} else {
if <condition2> [then] {
<plot_name> = <expression2>;
} else {
<plot_name> = <expression3>;
}
}