Download MetaTrader 5

[Indicator] Where the best place to put the global variables? Inside init(){...} or outside the function??

To add comments, please log in or register
Do you need private account monitoring? The Signals will provide you one!
Musngi
301
Musngi 2016.10.14 14:11 

Where the best place to put the global variables? Inside init(){...} or outside the function?? My variables will used in many functions repeatedly. 

I want to know the best way and efficiently to create indicator. 

whroeder1
14470
whroeder1 2016.10.14 17:57  
If they are declared inside a function they are local to the function, not global.
Musngi
301
Musngi 2016.10.14 18:55  
WHRoeder:
If they are declared inside a function they are local to the function, not global.
init() function is initialization, it sounds like global to me. I tried to put global variable in init() function but MQL gave me a warning. 
Keith Watford
Moderator
9603
Keith Watford 2016.10.14 21:22  
Musngi:
init() function is initialization, it sounds like global to me. I tried to put global variable in init() function but MQL gave me a warning. 
WHRoeder:
If they are declared inside a function they are local to the function, not global.
To add comments, please log in or register