Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 669
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
I've read your correspondence arising from my topic, it's all fun :-) but what about the question which caused all this buzz?
Declaring an array viaSetIndexBuffer(1, tmp1) gives me nothing. Of course, I can increase array size in the same loop, but I want to know a simpler and more efficient way.
Show me the code in full - what you've done there, what you wanted and what you've got.
I want to watch for volatility. At least open-close to start with, averaging over a period is done using SMAs.
I want to watch for volatility. At least open-close to start with, averaging over a period is done with SMA.
SetIndexBuffer(1, tmp1) why not in OnInit() ?
Why no IndicatorBuffers(2) ?
Why don't you calculate it optimally? There is a full loop on every tick.
Why iMA() and not iMAOnArray() ?
=Whyno IndicatorBuffers(2) ?
#property strict doesn't complain about it, that's probably why I didn't write it in.
=WhyiMA() and not iMAOnArray() ?
I don't have enough knowledge and the textbook doesn't say anything about it.
Lack of system knowledge is a serious limitation.
=Full loopon every tick.
I do not understand anything about it, please explain why or give me a link to where it is done.
I have a minimum one hour TF.
I don't understand any of this, please explain it or give me a link to where it is done.
I have a minimum TF of one hour.
At every call to OnCalculate you have the for loop for whizzing through the data from 1 to rates_total, i.e. doing the same job. This, of course, is a bad thing.
=Whyno IndicatorBuffers(2) ?
#property strict doesn't complain about it, that's probably why I didn't write it in.
=WhyiMA() and not iMAOnArray() ?
I don't have enough knowledge and the textbook doesn't say anything about it.
Lack of system knowledge is a serious limitation.
=Full loopon every tick.
I do not understand anything about it, please explain why or give me a link to where it is done.
I have a minimum one hour TF.
You know, I've attached an indicator template to this thread - somewhere in the middle of it - you can find it and make whatever you want out of it. Look it up. I also wrote that a lot of times people are interested in what's going on, so I decided to make an indicator template and put it in this thread.
Forum on trading, automated trading systems & strategy testing
Any questions from newbies on MQL4, help and discussion on algorithms and codes
Andrei Novichkov, 2018.10.17 22:06
At every call to OnCalculate you have for loop for scouring data from 1 to rates_total, i.e. doing the same job. This is certainly a bad thing.
If you say it's bad, tell me how to do it well. Should I move calculations to OnInit?
Forum on trading, automated trading systems & strategy testing
Any questions for newbies on MQL4, help and discussion on algorithms and codes
Artyom Trishkin, 2018.10.17 22:10
You know, I directly in this branch - somewhere in the middle of it, attached an indicator template - you can find it, and do directly from it what you want. Look it up. I wrote that a lot of people are interested in how it works and so I decided to make an indicator template and put it in this thread.
Searching for the words "indicator template" and your name doesn't find anything, and wrote here already on the volume of War and Peace.
Any combination of words from the post come to mind.
Made ClassName* className[], then ArrayResize on it, but does not give invalid pointer access to methods
How to create an array of class instances?
Made ClassName* className[], then ArrayResize on it, but does not give invalid pointer access to methods
There is an example inCArrayObj