Terminal Globals Problem

 

Hey, Folks

I've got something going on that's about to cause me to say goodbye to MT programming. The problem is in trying to set terminal globals. What I'm doing is something like this:

BuyEntrySignalGiven = Symbol() + "BuyEntrySignalGiven";
GlobalVariableSet(BuyEntrySignalGiven, (double) 1.0);

The set keeps giving me a 4051 error. The first parameter is a string, the second a double as they should be. Why it keeps claiming that a parameter type is invalid is beyond me. Both parameters are of the correct type. I don't get why it's blowing a fuse when the parameters are correct. I'm a custom software developer by trade and intended to add MT apps to my offerings. If the platform is unreliable, I won't touch it. Something that's squirrely will only make me look bad and sabotage my business. If anyone has insights to offer, I'd be most appreciative.

Many thanks,

Prof

 
GlobalVariableSet(BuyEntrySignalGiven, (double) 1.0);

Remove the double declaration. GV is already double, so no need to declare it again.



BuyEntrySignalGiven = Symbol() + "BuyEntrySignalGiven";

That code also problematic. Someone else will point it to you, if they have the time.

 
ProfessorMetal:

Hey, Folks

I've got something going on that's about to cause me to say goodbye to MT programming. The problem is in trying to set terminal globals. What I'm doing is something like this:

The set keeps giving me a 4051 error. The first parameter is a string, the second a double as they should be. Why it keeps claiming that a parameter type is invalid is beyond me. Both parameters are of the correct type. I don't get why it's blowing a fuse when the parameters are correct. I'm a custom software developer by trade and intended to add MT apps to my offerings. If the platform is unreliable, I won't touch it. Something that's squirrely will only make me look bad and sabotage my business. If anyone has insights to offer, I'd be most appreciative.

Many thanks,

Prof

I don't get a problem with this code :

string BuyEntrySignalGiven = Symbol() + "BuyEntrySignalGiven";
GlobalVariableSet(BuyEntrySignalGiven, (double) 1.0);     
Which build are you using ? How to reproduce your issue ?
 
I am thinking it is a more older build.
 

The double cast wasn't originally there. I added that because of the error. The second parameter is supposed to be a double. My background is C++/C# and I expected simply putting the argument in as 1.0 would be sufficient. I added the cast because the call failed and I wasn't sure if it was some idiosyncrasy of MQL4. I've already seen that MQL4 doesn't always play by expected rules. As far as the string assignment goes, I have another indicator that I wrote that follows the same format and works perfectly. I can't see anything problematic there. Symbol() returns a string, the concatenation is with a string, which is perfectly acceptable, and the variable the expression is being assigned to is also a string. The only thing I can see that might be a problem is concatenating the pair symbol with a string that is the same as the GV name. That shouldn't matter because the "finished" string isn't the same as the GV name. Maybe that's the problem. If it is, why not just say so?

Anyway, thanks for the reply

Prof

 

Actually MetaQuotes did say that you can't expect C++/C# coding style and rules at MQL4/5.


By the way, you didn't answer the moderator's question.

 

Interesting, Guys. I'm running Build 646. I don't think that's the problem. Uh - I think I just figured it out. It's me being tired and stupid. The GV names are set in a method that I meant to call from OnStart() and didn't. DUH! Slap the dimwit American and tell him to go to bed and get some sleep before he tries to code any more. I've been up for about 36 hours. You folks definitely helped me by inspiring me to step back and take another look at what I was doing. Many thanks and Good Night, Good Day - whichever it is where you are. :-)

Prof

 
I did answer, deysmacro. You didn't give my reply time to show up. As I said, it's basically a non-issue. The problem was a rookie mistake on my part due to fatigue. BTW, I know that not all things in MQL4/5 work the same as they do in C++/C#. I do recall, however, seeing a statement to the effect that part of the intention with the changes to MQL4/5 is to make it more like C++. The documentation could be a bit better organized and more thorough. To be fair, the same can be said of Microsoft.
 
It is quite simple actually. If they teach you or put a thorough documentation, at some point, ... ... ...
 

To be fair to MetaQuotes, what they're doing isn't trivial. I suspect that teaching yourself is always going to be the norm. To be honest, that's par for the course for a professional developer. It comes with the territory. Documentation and interaction with other developers is typically the only "teaching" you're going to get. C'est la vie. :-)

I'm still trying to figure out how to get the new debugging for MQL4 to work. I followed what I thought the documentation told me to do. When I tried to start the debugger, it popped up an H1 window and the properties dialog for the indicator I was trying to debug. When I OK'd out of the dialog the debugger shut down and the window disappeared. Oh, well. That's a topic for another thread, I suspect.

 
ProfessorMetal:

To be fair to MetaQuotes, what they're doing isn't trivial. I suspect that teaching yourself is always going to be the norm. To be honest, that's par for the course for a professional developer. It comes with the territory. Documentation and interaction with other developers is typically the only "teaching" you're going to get. C'est la vie. :-)

I'm still trying to figure out how to get the new debugging for MQL4 to work. I followed what I thought the documentation told me to do. When I tried to start the debugger, it popped up an H1 window and the properties dialog for the indicator I was trying to debug. When I OK'd out of the dialog the debugger shut down and the window disappeared. Oh, well. That's a topic for another thread, I suspect.


It was a longlasting bug, that could have been avoided when you selected other pane of the input dialogue than input entries. Then the next run succeeded. With the 646 it seems fixed. Unfortunately there are not many such informations on this site. Usually most issues end up with "report to service desk" without any additional trace.

Reason: