
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
- www.mql5.com
Symbol Properties - Environment State - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
- Real and Generated Ticks - Algorithmic Trading, Trading Robots
- Testing Features - Algorithmic Trading, Trading Robots
- Market Watch - Trading Operations
- Please use "</>" icon or Alt-S to add your code. Don't just copy/paste it as normals text. It makes it difficult to read and help you.
- Since the Indicator handles will be used globally, remove the "int" in front of the lines that assign the handles.
int OnInit() { ma_9_h = iMA(_Symbol, _Period, 9, 0,MODE_LWMA, PRICE_CLOSE); ma_21_h = iMA(_Symbol, _Period, 21, 0,MODE_LWMA, PRICE_CLOSE); return INIT_SUCCEEDED; };
- However, the above code is not enough. You should always check the handles to make sure they are valid before using them elsewhere.
- You should also check the return values of the CopyBuffer functions to make sure valid data is returned.
- Your code has other problems too, which you will need to fix if you want your code to work properly.
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor -
Don't double post! You already had this thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)
hides globar variable
I think you are using the same variable nane in 2 or more locations in addition to the global var
Try ctrl-f (from your keyboard) to search the variable name then you must see it duplicated two or more times

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