
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
Well, my code must be complicated to understand since I use french names for my variables :/ So what I'm trying to do is to draw manually a resistance and/or a support, then if the price goes over one of it, over the resistance for example, it will close all my sell positions for the chart, and if the variable 'ordre_si_depassement' is set to true, it will also send a buy order. perteMax is used to determine my maximal lose for one trade, and bollinger_close and bollinger_depassement tell if the EA must use bollinger bands to work or not.
I admit that I don't know how to access to Global variables from an EA, can I access to it like if I declared it in the EA or do I have to use some function ?
I'm not so sure what you trying to achieve. As far as I know we can not change the value of extern variable. However with a little trick, we actually can by assign them to global variable. Global variable does not lose it's value when changing TF, Symbol or open up property window.
Please study this EA, and attach to a chart and open its property (press F7) or change TF and Symbol over and over, but don't change EA extern variable.
:D
... (my english isn't very good) ...
My first language is English and I have trouble understanding the documentation. I think most of the documentation was translated from Russian. And the translation is not so good in places.
Hi MisterDog,
Here https://www.mql5.com/en/forum/139870
:D
This works perfectly.
I'm not so sure what you trying to achieve. As far as I know we can not change the value of extern variable. However with a little trick, we actually can by assign them to global variable. Global variable does not lose it's value when changing TF, Symbol or open up property window.
Please study this EA, and attach to a chart and open its property (press F7) or change TF and Symbol over and over, but don't change EA extern variable.
:D
Okay, I didn't thought about this solution, works well :) But when you told me to use GV, I thought about GV with the GUI, which keep its value even if you restart your EA or MT4, so I coded a new init function:
Then I use GlobalVariableGet() and GlobalVariableSet() to work with these variables, it works well too ;)
This works perfectly.
I'm not sure about what you're meaning.. if I change var value from the EA, var will keep its default value with the GUI, 1 here, while the EA will actually says that var has been changed, so it doesn't really work :/
Well, Like I've said, I'm not so sure what you've trying to achieve, However, GlobalVariable() and File keeps it's value when EA, MT4 or even Computer is switched off. Just don't forget to make the name of GlobalVariable() different for each EA, Symbol, TF, and Chart. So it won't be a mess.
:D
Well, Like I've said, I'm not so sure what you've trying to achieve, However, GlobalVariable() and File keeps it's value when EA, MT4 or even Computer is switched off. Just don't forget to make the name of GlobalVariable() different for each EA, Symbol, TF, and Chart. So it won't be a mess.
:D
Yep, I already make a different name for each Symbol, don't need other details for the moment :)
Thanks for help !