i need help for the error 'SymbolInfoDouble' - function declarations are allowed on global, namespace or class scope only
- Before posting the code formate it withe Styler in the Editor(in Tools).
- Post your code as code with either ALT+S or
- Error messages having globe scope indicate incorrect bracket placements - which are easier to detect in formatted code (see 1.)
- You cant declare any function within another function - check theses brackets.
- Before posting the code formate it withe Styler in the Editor(in Tools).
- Post your code as code with either ALT+S or
- Error messages having globe scope indicate incorrect bracket placements - which are easier to detect in formatted code (see 1.)
- You cant declare any function within another function - check theses brackets.
- Before posting the code formate it withe Styler in the Editor(in Tools).
- Post your code as code with either ALT+S or
- Error messages having globe scope indicate incorrect bracket placements - which are easier to detect in formatted code (see 1.)
- You cant declare any function within another function - check theses brackets.
//+------------------------------------------------------------------+ //| Spread Limit | //+------------------------------------------------------------------+ #property version "1.00" #property strict // Declare global variable to store tick information MqlTick m_tick; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- check spread every tick SymbolInfoTick(Symbol(),m_tick); //--- check spread limit CheckSpread(); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- update tick information SymbolInfoTick(Symbol(),m_tick); //--- check spread limit CheckSpread(); } //+------------------------------------------------------------------+ //| Check spread limit function | //+------------------------------------------------------------------+ void CheckSpread() { //--- get spread for the symbol double SymbolInfoDouble( string EURUSD, // Symbol ENUM_SYMBOL_INFO_DOUBLE prop_id // Identifikator der Eigenschaft ); //--- disable trading buttons if spread is too high if (MODE_SPREAD > 10) { ExpertRemove(); } } //+-----------------------------------------------------------------+heres the code with alt s
And what are the compiler errors now?
Beside your try do you know that there's virtually nothing that hasn't already been programmed for MT4/MT5 and is ready for you - so searching gives better results than AI or ChatGPT and it's a lot faster: https://www.mql5.com/en/search
Anyway here is a list of all function where you can search with CTRL+F: https://www.mql5.com/en/docs/function_indices
Quickstart for newbies: https://www.mql5.com/de/articles/496
und: https://www.mql5.com/de/articles/100
(Schrittweiser Leitfaden für Anfänger zum Schreiben eines Expert Advisors in MQL5)
Kochbücher: https://www.mql5.com/de/search#!keyword=kochbuch
And a final hint: place the cursor on a function or keyword of MQL5 and press F1 to see immediately how it can be used_ Parameters, return value ... many with examples to copy, paste, and change.
- www.mql5.com
And what are the compiler errors now?
Beside your try do you know that there's virtually nothing that hasn't already been programmed for MT4/MT5 and is ready for you - so searching gives better results than AI or ChatGPT and it's a lot faster: https://www.mql5.com/en/search
- 'SymbolInfoDouble' - function declarations are allowed on global, namespace or class scope only, that the error code
- i just want an ea wich is always active, shows me the current spread for EURUSD on the top right and the important thing, it should make it unable to Sell or buy EURUSD if the spread is going over 10 so just deactivate the sell/buy buttons
- An EA cannot stop the trading generally only for itself if there is an return e.g. at the beginning of OnTick().
- Here: double SymbolInfoDouble(... you forgot to name a variable like: double sprd = SymbolInfoDouble(
- DONT'T use ChatGPT we're tired correcting the rubish it creates.
- Ask Google for "site:mql5.com show spread" or learn to code!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
...
...