- EA Failed in Live Trading although Worked in Backtesting
- AMA SLOPE - New Stuff
- how can i get a variable value from Custom indicator (form the code of the EA)?
If you want to read values of a variable from another ea then you'll need to use the GlobalVariableSet(). Write the Variable to File, then read the file is another option for you.
it seems that when I use the function, GlobalVariableSet() it always defines as double.
defines "G_Longrange" as double in spite of it being Boolean.
RTFM it is always a double.
That means the GV value can be bool, int, double or datetime. RTFM bools, ints, doubles, or datetimes are trival conversions (assignments)
That means the GV name is a string
What more do you want?
The GVS was designed that way because it needs to be flexible. Usually I don't have a problem with it. If I know the variable is bool, I would not add floating values upon it [ but thats just me ]. Anyways, I don't use GlobalVariable's directly. I would define an actual bool_local_variable which would get the values for the gv at the beginning of start(). Also there would be another function which set all my local_variables to gv at the end of the start function. I do this because I don't like working with long variable_name/functions and it's just a matter of preference. However, in your case, it might serve to add another level of error_checking which you seem to desire.
Ps: if Longrange is a bool. Then Longrange+0.2 turning into 1.2 could be the effect of TypeCasting. This is a different matter altogether.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use