I'm learning Optima script and I've made a scanner code. As far as I can tell, I followed all the syntax rules; but I'm getting an error that its not a valid script.
1. In calculating "Y" for the slope of the signal line, the second MA has to be "X" bars back from the first MA. I notated that close as "close[X]" to mean the close of the bar 5 bars in the past. Is this the correct syntax?
2. As for the rest of the code, I don't know what could be wrong with it. Can anyone see an error with it?
// Wavy Tunnel Breakout #1 Scanner //==================================================================================
// ==================================
// Raghee Wave
// ==================================
EMA34H = MA(BARS=34, STYLE=Exponential, CALC=High);
EMA34C = MA(BARS=34, STYLE=Exponential, CALC=Close);
EMA34L = MA(BARS=34, STYLE=Exponential, CALC=Low);
// ==================================
// Vegas Tunnel
// ==================================
EMA12 = MA(BARS=12, STYLE=Exponential, CALC=Close); //Signal Line
EMA144 = MA(BARS=144, STYLE=Exponential, CALC=Close);
EMA169 = MA(BARS=169, STYLE=Exponential, CALC=Close);
// =========================================
// Slope Of Signal Line
// =========================================
X = 5;
Y = MA(STYLE=Exponential, BARS=12, CALC=Close) - MA(STYLE=Exponential, BARS=12, CALC=Close[X]) ;
MA1 = MA(BARS=8, CALC=HLC/3);
MA2 = MA(BARS=8, CALC=Close);
// =========================================
// Buying Criteria
// =========================================
Criteria1 = ArcTan(Y/X) * 180 / Pi >= 1;
Criteria2 = EMA12 Crosses Above Max(EMA144,EMA169);
Criteria3 = EMA12 Crosses Above Max(EMA34H,EMA34L);
Criteria4 = Max(EMA34H,EMA34L) Crosses Above Max(EMA34H,EMA34L);
Criteria5 = Max(EMA34H,EMA34L) Crosses Above Max(EMA144,EMA169);Criteria1 And (Criteria2 Or Criteria3 Or Criteria5); // Scan Output
Wavy-Tunnel-BO-1-Scan-OGT-1.txt (1.35 KB)