Posted By: chsmac85
Syntax error - series with math operations - 01/14/19 23:47
I can't get past the following as I keep getting a syntax error. It should be a fairly simple mean reversion script but I can't figure out what is the syntactical error in the declaration of my absolute price difference variable.
Code:
function run() { vars Close = series(priceClose()); vars SMA200 = series(SMA(Close,200)); vars SMA20 = series(SMA(Close,20)); vars Price_diff200 = series((abs(Close - SMA200) / float(Close)) * 100.0); if(Price_diff200 > 2.0) if(SMA20 < SMA200) enterLong(); else if(SMA20 > SMA200) enterShort(); }