Works for me, always did but tested anyways.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void start(){ double EquityHigh=9999; datetime Time_GSet=GlobalVariableSet("t_EquityHigh",EquityHigh); int All_Del=GlobalVariablesDeleteAll("Should_Delete_All_Anyways"); int Pre_Del=GlobalVariablesDeleteAll("t_"); Print("Time_GSet="+Time_GSet," All_Del="+All_Del," Pre_Del="+Pre_Del); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19:11:20 Help: loaded successfully 19:11:21 Help test started 19:11:21 2011.01.02 23:00 Help EURUSD,M1: Time_GSet=1343178681 All_Del=0 Pre_Del=1
The number of times someone says Bug and is actually correct around here is like 0.001%.
It doesn't work for me, and I tried it on two different brokers to make sure. There was no GV present with the prefix in the string variable when the command executed, and it deleted the other GV. It shouldn't have touched the other one. I commented out all the GlobalVariablesDeleteAll statements in the EA and went through one-by-one to see which was the culprit.
It deleted the GV when I loaded a template that contained the EA, the code is in the init() function. Sorry, this is a bug IMO.
Here is before/after screenshots of loading the template:
I provided a complete code which compiles. Why don't you run my code and report what it prints out. Then you can write a simple code like mine and test what you're trying to do. Then other people can test your simple code as well. Of all the people who use globalvariable() on this site you're the only one having this bug?
Your code doesn't do anything differently than what I'm doing (other than print the return value). There is nothing wrong with my code as posted.
I've used this code for a long time and never noticed a problem until yesterday when my GVs were wiped out after loading a template that included the EA.
Your code doesn't do anything differently than what I'm doing (other than print the return value). There is nothing wrong with my code as posted.
I've used this code for a long time and never noticed a problem until yesterday when my GVs were wiped out after loading a template that included the EA.
Here ya go.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void start(){ static bool run_once; if(run_once==true){return;} GlobalVariableSet("GridV2_EURUSD_30_108926349",Open[0]); string MT4GV_TS_Prefix = "TSv2_"+Symbol()+"_"+Period()+"_"; GlobalVariablesDeleteAll(MT4GV_TS_Prefix); Alert("Code Made it this far therefore all globals should be Deleted"); run_once=true; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As you can clearly see, something must be off in your Computer or in your Code.
Your code as posted does not compile. So that's a big difference. I'll go ahead and complete your code and test that since you wouldn't.
Well, it compiles on my machine beacuse the MT4GV variable is previously defined as a string type. When it executes, what is shown in my screenshot is what happens. I guess I'm going to have to re-install MT4 as something is not right.
Few things you could check are the
a) Template you're using. Make sure it's doesn't have indicators or other versions of your expert which may contain GlobalVariablesDeleteAll.
b) Check if you've installed Mt4 within the Programs Folder. If you have then you may want to install it outside of the Program Folder. Put it somewhere like just on the C-Drive, C:\Mt4_Folder.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When I specify a name prefix, it's deleting all Global Variables, not just the GVs with the prefix.
There's a message in the forum back in 2006 that suggests this would be fixed, it's broken again.