global initialization failed!!!!!!! - page 6

To add comments, please log in or register
Jeffrey Irick
339
Jeffrey Irick  
SDC:

You use int OnCalculate() in place of int start(). It runs on every tick like start(). A before and after would look something like this,

OnCalculate's formal parameters make it more self contained, the coder doesn't have to rely on calling all kinds of globals which apparently in oop circles is bad bad coder, slap on wrist. In practice there really is not much difference between using either of them. Also OnCalculate is the same as mql5 so you have the option to write compatabie code.


Thanks, SDC. I think I see what you're getting at. I'm not sure that I like the direction that MetaQuotes is going with this. They're doing the same thing that Microsoft has done. It may make coding easier but it seriously reduces the programmer's need to understand what's really going on "under the hood", so to speak. That's a huge problem, in my mind, because it reduces the skill and understanding of programmers. If you want to be a master of what you do, you have understand it from the most basic level to the higher concepts. I started programming in 1978. We wrote in binary and octal code. Most people now wouldn't have a clue. Microsoft has been pushing programming languages to a level that completely separates the programmer from knowing what's really going on under the hood for many years and it isn't for our benefit. Their intent is to see to it that only their programmers now what's really going on at low levels and everybody else has to rely on them.

An example of what I'm talking about is the evolution from C++ to C#. Ostensibly, C# is meant to make the programmer's life easier by doing the low level "plumbing" for them freeing them from needing to know how to do it for themselves and also speeding up development time in the process. Sure, it achieved that, but at what cost? We "old timers" completely understand direct memory access and how to use it. We know what's going on "under the hood". I've often needed to specifically allocate a certain amount of memory or manipulate memory byte by byte or even bitwise. Does someone who only knows the high level "cloud" of C# have a clue? Nope. Call Microsoft.

I know I've gotten off on a rant here but I think that MetaQuotes is moving in the same direction and that's not a good thing. It's most definitely not a good thing when you're talking about writing aps that have to deal with real-time data. In our arena a screwup could cost somebody a lot of money. I can live with it if I screw up on an app that I intend only for my personal use. If I screw up on an app that I'm selling that's not acceptable.

BTW, I don't think that globals as used in OOP and globals as used in MQL are the same concept. MQL is still an infant in terms of being a true object oriented language. In fact, "global" means nothing in OOP. It's called a "static" variable and is available to all objects created from the same class as well as any classes in a derived hierarchy. It is frowned upon for data encapsulation reasons as well as being a maintenance nightmare especially when it's used in a very high level class that everything in an application depends on.

Syed Naufal Gaddafi
1895
Syed Naufal Gaddafi  

Basically if you want to get the numbers from account, you just need to use AccountBalance()

So, if you really want to know how exactly balance is derived, you have no idea. Only devs knows.

Ian Venner
2397
Ian Venner  
ProfessorMetal:


Thanks, SDC. I think I see what you're getting at. I'm not sure that I like the direction that MetaQuotes is going with this. They're doing the same thing that Microsoft has done. It may make coding easier but it seriously reduces the programmer's need to understand what's really going on "under the hood", so to speak. That's a huge problem, in my mind, because it reduces the skill and understanding of programmers. If you want to be a master of what you do, you have understand it from the most basic level to the higher concepts. I started programming in 1978. We wrote in binary and octal code. Most people now wouldn't have a clue. Microsoft has been pushing programming languages to a level that completely separates the programmer from knowing what's really going on under the hood for many years and it isn't for our benefit. Their intent is to see to it that only their programmers now what's really going on at low levels and everybody else has to rely on them.

An example of what I'm talking about is the evolution from C++ to C#. Ostensibly, C# is meant to make the programmer's life easier by doing the low level "plumbing" for them freeing them from needing to know how to do it for themselves and also speeding up development time in the process. Sure, it achieved that, but at what cost? We "old timers" completely understand direct memory access and how to use it. We know what's going on "under the hood". I've often needed to specifically allocate a certain amount of memory or manipulate memory byte by byte or even bitwise. Does someone who only knows the high level "cloud" of C# have a clue? Nope. Call Microsoft.

I know I've gotten off on a rant here but I think that MetaQuotes is moving in the same direction and that's not a good thing. It's most definitely not a good thing when you're talking about writing aps that have to deal with real-time data. In our arena a screwup could cost somebody a lot of money. I can live with it if I screw up on an app that I intend only for my personal use. If I screw up on an app that I'm selling that's not acceptable.

BTW, I don't think that globals as used in OOP and globals as used in MQL are the same concept. MQL is still an infant in terms of being a true object oriented language. In fact, "global" means nothing in OOP. It's called a "static" variable and is available to all objects created from the same class as well as any classes in a derived hierarchy. It is frowned upon for data encapsulation reasons as well as being a maintenance nightmare especially when it's used in a very high level class that everything in an application depends on.

Well I think MQ's direction is towards is achieving mql4 - mql5 compatability, you will see we are already drifting into mql5 territory with OnTick, OnTimer, OnCalculate, and a array of mql5 functions that are now available for us to use. You will find it does not make it easier though. If anything the new version is tougher on us than before, the old mql4 would allow us to write really quite sloppy code and get away with it, the new one expects us to be more accurate.
Syed Naufal Gaddafi
1895
Syed Naufal Gaddafi  

That is why ea generator can't be used anymore. Unless the code is updated, you really need to code the indi/ea yourself.

Practically, discipline is the key in doing programming. It is tough, but you are becoming more powerful in coding.

Jeffrey Irick
339
Jeffrey Irick  
SDC:
Well I think MQ's direction is towards is achieving mql4 - mql5 compatability, you will see we are already drifting into mql5 territory with OnTick, OnTimer, OnCalculate, and a array of mql5 functions that are now available for us to use. You will find it does not make it easier though. If anything the new version is tougher on us than before, the old mql4 would allow us to write really quite sloppy code and get away with it, the new one expects us to be more accurate.


I see what you're talking about. I was looking at some of the documentation and realized that I was misunderstanding the usage of the new methods. OnStart() is for the startup of scripts, OnCalculate() replaces the old start() for indicators and is supposed to replace a lot of the counted bars business that everybody used in the old incarnation of MQL as well as kicking off the execution of the indicator code when a new tick is received(provided it isn't currently running) and, finally, OnTick() replaces start() for EAs. Along with many other changes, you're right - it doesn't make our life easier because we have to "re-learn" and for those who have been at this for awhile and have a number of apps put together, it's going to cause a lot of re-engineering to keep them running. As for myself, I was just beginning to get a handle on MQL and this cracked me a good one. Most of what I'd learned I now have to "unlearn", as it were.

As to things being stricter - that's a good thing, in my opinion. It may be a pain to get used to, but it will reduce the potential for errors that could prove to be costly for our users and ourselves. From the perspective of someone who's spent years in the corporate world working on apps in which mistakes on our part could cost our users massive amounts of money(and us our jobs), I'm a champion of accuracy. What I was getting at, though, is that by doing things like introducing the OnCalculate() that does half the work for you reduces your understanding of what's going on under the hood. I'm speaking from experience when I talk about the shift from C++ to C#. You went from knowing "how this works" to "I punch this button and this happens". Maybe I'm Old School, but I don't think that dumbing down is a good thing. This re-engineering has both good and bad points.

Jeffrey Irick
339
Jeffrey Irick  
deysmacro:

That is why ea generator can't be used anymore. Unless the code is updated, you really need to code the indi/ea yourself.

Practically, discipline is the key in doing programming. It is tough, but you are becoming more powerful in coding.


No argument there, Friend. To tell the truth, I don't think EA generators should have ever been used. You don't have any idea what a "black box" is actually doing. As to your second statement, I'm with you all the way.
Dadas
260
Dadas  
ProfessorMetal:

You went from knowing "how this works" to "I punch this button and this happens". Maybe I'm Old School, but I don't think that dumbing down is a good thing. This re-engineering has both good and bad points.

Look at it this way: It would be a practically impossible job for any one person or even an organised company of people to program something like MT4 completely of binary code from scratch. Not to mention the modern computer games that are around. There will be a time when no living person will even have the slightest clue about binary, octal, hexidecimal or even Basic. First, you build of elements, then as time goes by, you get blocks, then maybe whole stories, whole books. You just reassemble the plots and end up with something seemingly new, though it's the same old shi_ every time. The world changes, one can't get stuck on the same old scenario! One has to re-learn all the time, read the manual, first. Then again, and again, and again. Otherwise, one falls behind and becomes a dinosaur.

Jeffrey Irick
339
Jeffrey Irick  
Dadas:

Look at it this way: It would be a practically impossible job for any one person or even an organised company of people to program something like MT4 completely of binary code from scratch. Not to mention the modern computer games that are around. There will be a time when no living person will even have the slightest clue about binary, octal, hexidecimal or even Basic. First, you build of elements, then as time goes by, you get blocks, then maybe whole stories, whole books. You just reassemble the plots and end up with something seemingly new, though it's the same old shi_ every time. The world changes, one can't get stuck on the same old scenario! One has to re-learn all the time, read the manual, first. Then again, and again, and again. Otherwise, one falls behind and becomes a dinosaur.


I see your point, Dadas. And I agree with you up to a point. However, someone is ALWAYS going to have to know the subject from the ground up or the whole house of cards is going to come crashing down. Let me give you an illustration of what I'm getting at. I've spent my time as a professional educator. I hold the rank of Assistant Professor of Math and Physics. I taught for a community college and our "permanent" Physics Department consisted of myself and the head of the department.

At the time, the Math department was leaning toward the direction of having all the instruction done by teaching the students statistics, calculus, linear algebra, etc. by using computer or calculator programs. They weren't teaching them anything about the actual subjects. All the students were being taught was how to use the programs. That isn't learning the mathematics. It's punching the Start button entering some numbers and hitting the "Go" button. I had students come to complaining bitterly because they followed all the "instructions" and still got the problem wrong. My first question to them was, "Did the answer the calculator give seem reasonable?" The response? "Well, uh, I don't know." Why didn't they know? Because they didn't know jack shit about the math. All they knew was punch these buttons in this sequence and the calculator will magically spit out the answer. WRONG!

Now, back to my original point. My partner was all in favor of this. His rationale? "Well some day this is how it's all going to be done. Nobody is going to need to know how to actually do the math and physics like we do. The programs are going to do it all." My response, "Yeah, right. And how, exactly, are they going to know when the "answers they get are completely unrealistic? For that matter, who the hell is going to write and maintain all this stuff when people have gotten to the point that they can't even do basic math because they've been trained to let the machine do it for them?" Do you see my point? SOMEBODY is going to have to know "how its works" or, in the words of Jim Morrison - the whole shit house is going up in flames." And that, my friend, is where the dinosaurs like me come in. I may go down kicking and screaming but I'll go down teaching until the end. When the shit house goes up in flames it won't be because I took the lazy way out. :-)

Dadas
260
Dadas  
ProfessorMetal:


I see your point, Dadas. And I agree with you up to a point. However, someone is ALWAYS going to have to know the subject from the ground up or the whole house of cards is going to come crashing down. Let me give you an illustration of what I'm getting at. I've spent my time as a professional educator. I hold the rank of Assistant Professor of Math and Physics. I taught for a community college and our "permanent" Physics Department consisted of myself and the head of the department.

At the time, the Math department was leaning toward the direction of having all the instruction done by teaching the students statistics, calculus, linear algebra, etc. by using computer or calculator programs. They weren't teaching them anything about the actual subjects. All the students were being taught was how to use the programs. That isn't learning the mathematics. It's punching the Start button entering some numbers and hitting the "Go" button. I had students come to complaining bitterly because they followed all the "instructions" and still got the problem wrong. My first question to them was, "Did the answer the calculator give seem reasonable?" The response? "Well, uh, I don't know." Why didn't they know? Because they didn't know jack shit about the math. All they knew was punch these buttons in this sequence and the calculator will magically spit out the answer. WRONG!

Now, back to my original point. My partner was all in favor of this. His rationale? "Well some day this is how it's all going to be done. Nobody is going to need to know how to actually do the math and physics like we do. The programs are going to do it all." My response, "Yeah, right. And how, exactly, are they going to know when the "answers they get are completely unrealistic? For that matter, who the hell is going to write and maintain all this stuff when people have gotten to the point that they can't even do basic math because they've been trained to let the machine do it for them?" Do you see my point? SOMEBODY is going to have to know "how its works" or, in the words of Jim Morrison - the whole shit house is going up in flames." And that, my friend, is where the dinosaurs like me come in. I may go down kicking and screaming but I'll go down teaching until the end. When the shit house goes up in flames it won't be because I took the lazy way out. :-)


Well, then you're going to end up as Don Kichote.

And, yes, we won't live to see it, but it is going to be that way, sooner or later. After all, nobody knows the shit how and why this whole Universe is working, yet it is working. Do you know if you're getting the correct answers from the Universe itself? How can you ever know that? I understand the mathematician's way of thinking. They want formulas to control everything and they want to know/understand where the formulas arrise from, c/z they want to be in control. 2+2=4, but why? Is this really the correct answer? The truth is, you can never be in control.

And, after all is said and done, you get "global initialization failed" and nobody really knows why or how to fix that.

Jeffrey Irick
339
Jeffrey Irick  
Dadas:


Well, then you're going to end up as Don Kichote.

And, yes, we won't live to see it, but it is going to be that way, sooner or later. After all, nobody knows the shit how and why this whole Universe is working, yet it is working. Do you know if you're getting the correct answers from the Universe itself? How can you ever know that? I understand the mathematician's way of thinking. They want formulas to control everything and they want to know/understand where the formulas arrise from, c/z they want to be in control. 2+2=4, but why? Is this really the correct answer? The truth is, you can never be in control.

And, after all is said and done, you get "global initialization failed" and nobody really knows why or how to fix that.


LOL I think you meant Don Quixote. Anyway, the point is that we we really need to understand what we're working with or we're heading straight for eventual failure.
To add comments, please log in or register