EA Code Errors making me go loopy
HI all,
Would be very grateful if anyone could figure out why my code is, throwing off the following errors:
'}' - unexpected end of program 426 2
'{' - unbalanced parentheses 59 1
My Code is attached.
Thanks v much!
HI all,
Would be very grateful if anyone could figure out why my code is, throwing off the following errors:
'}' - unexpected end of program 426 2
'{' - unbalanced parentheses 59 1
My Code is attached.
Thanks v much!
As written this: '{' - unbalanced parentheses 59 1 has no closing ]
So save your EA under a different name and start from inner { - } pairs to delete them this way you can easily find where is the } missing. (The last else)
//+------------------------------------------------------------------+ //| Custom Indicator | //+------------------------------------------------------------------+ double CiKAMA(…){ ⋮ for (i = count; i < rates_total; i++){ ⋮ if (i == count){…} else{ ⋮ if (tr > ad){…} else if (tr < ad){ kama[i] = kama[i - 1] + slow_sc * (close[i] - kama[i - 1]); <<<<<<< End of else if? <<<<<<< End of else? <<<<<<< End of for? } <<<<<<<<< End of CiKAMA int start(){…} void OnTick(…){
- Pete H: '}' - unexpected end of program 426 2Obvious
- A Custom indicator can't have an OnTick.
- You can have the old event handlers or the new. Not both.
-
You should stop using the old event handlers (init, start, deinit) and IndicatorCounted() and start using new event handlers (OnInit, OnTick/OnCalculate, OnDeinit).
Event Handling Functions - MQL4 Reference
How to do your lookbacks correctly - MQL4 programming forum #9-14 & #19 (2016) -
sma = iMA(NULL, 0, g_smaPeriod, 0, MODE_SMA, PRICE_CLOSE, 1); kama = iCustom(NULL, 0, "KAMA", g_kamaFastPeriod, g_kamaSlowPeriod, g_kamaSignalPeriod, g_kamaFastMult, g_kamaSlowMult, g_kamaSignalMult, 0, 1);
MT4 code. Stop using ChatGPT.
Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum #2 (2023)
HI all,
Would be very grateful if anyone could figure out why my code is, throwing off the following errors:
'}' - unexpected end of program 426 2
'{' - unbalanced parentheses 59 1
My Code is attached.
Thanks v much!