Augusto Ramos: '}' - unexpected end of program Hota001.mq5 89 6
-
Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum #25 (2019)
Forum rules and recommendations - General - MQL5 programming forum (2023)
Messages Editor -
int ticket = OrderSend(_Symbol, trade_type, lot_size, close, 3, stoploss, takeprofit, "Sell Order", 0, 0, Red);
Why did you post your MT4 question in the MT5 EA section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon. -
void OnInit() { // Calculate the Exponential Moving Average ema = iMA(_Symbol, PERIOD_CURRENT, ema_period, 0, MODE_EMA, PRICE_CLOSE, 0); // Define the OnTick() function void OnTick() {
You can't define a function (OnTick) inside another (OnInit).
- Don't try to use any price (or indicator) or server related functions in OnInit (or on load or in OnTimer before you've received a tick), as there may be no connection/chart yet:
- Terminal starts.
- Indicators/EAs are loaded. Static and globally declared variables are initialized. (Do not depend on a specific order.)
- OnInit is called.
- For indicators OnCalculate is called with any existing history.
- Human may have to enter password, connection to server begins.
- New history is received, OnCalculate called again.
- A new tick is received, OnCalculate/OnTick is called. Now TickValue, TimeCurrent, account information and prices are valid.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone! When I compile the code below there are 2 errors:
'}' - unexpected end of program Hota001.mq5 89 6
'{' - unbalanced parentheses Hota001.mq5 17 3
But when I add an } in the end, the errors jump to 17. Any help?