I have a script that plots price lines based on some calculations, however I am currently defining variables based on inputs.
The goal here is to define variables dynamically based on the current symbol.
Example
If the current symbol is AMD, define Price1 as 50 and Price2 as 20.
If the current symbol is SPX, define Price1 as 3000 and Price2 as 2900.
For some reason, this logic is displaying "Invalid statement: if at 1:1" and "Syntax error: Semicolon expected at 1:1". Can anyone help? I really can't tell what I am missing, or if switch statement would be better.
The goal here is to define variables dynamically based on the current symbol.
Example
If the current symbol is AMD, define Price1 as 50 and Price2 as 20.
If the current symbol is SPX, define Price1 as 3000 and Price2 as 2900.
For some reason, this logic is displaying "Invalid statement: if at 1:1" and "Syntax error: Semicolon expected at 1:1". Can anyone help? I really can't tell what I am missing, or if switch statement would be better.
Code:
if GetSymbol() == "SPX" {
Price1 = "2900";
Price2 = "3000";
} else
if GetSymbol() == "AMD" {
Price1 = "50";
Price2 = "20";
} else {
Double.NaN;
}