Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1222
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
Good afternoon!
How do I reset the array structure?
Tried this but it doesn't seem to work!
Any other possibilities?
Good afternoon!
How do I reset the array structure?
Tried this but it doesn't seem to work!
Any other possibilities?
What do you mean by null? Judging by your trials, ArrayFree would work for you.
And in the conventional sense ZeroMemory
Shouting, yelling, cursing, not wanting to make your own code work, blaming moderators and admins, insulting moderators and admins...
In general - the whole package. I will give you one week to cool down and sort out your mistakes. Thoughtful!
I have not insulted anyone and shouted - and my code works (already forgot what I was asking ... :)) - no blame no one on anyone. Sorry if someone - that hurt inadvertently.
All of my robots are operational and working.
If you have any questions I will ask here, thank you for your help.
What do you mean by zeroing? Judging from your trials, ArrayFree is the right choice for you.
And in the conventional sense, ZeroMemory.
The error is as follows:
At a new bar the objects that were set when the indicator was started are shifted.
I think the structure accumulates the values of objects.
Task is to reset structure and recalculate object values each bar.
Thank you, It worked! ZeroMemory - It worked!
- the code (especially the first one) is worth commenting
- OnTick() has long been used instead of Start()
- buy at Ask price, not as you would like. You want to buy at Bid. (and the same with sales).
- and so many-many-many things... so many that it is impossible to cover everything
So the first thing you have to do is comment on the code. If you don't understand it, you can ask, but only after trying to figure it out for yourself
Ok, thanks, I will change ask to bid and vice versa. For me OnTick will not be suitable, because I need to always refer to the previous closed bar. I have a question, is it possible to set the work timer equal in time to the start of a new bar opening?
Reference to previous bar (a 4):
Time[1] - opening time
High[1] - high
Low[1] - minimum
and so on.
This is not an excuse to use obsolete interfaces. Not only is the 4-bit obsolete, but people might stop understanding you :-)
There is no need to set the timer.
You have to catch and process the event "opening of a new bar".
And every 5th question "about EAs" is dedicated to this - just browse the topic
Reference to previous bar (a 4):
Time[1] - opening time
High[1] - high
Low[1] - minimum
and so on.
This is not an excuse to use obsolete interfaces. Not only is the 4-bit obsolete, but people might stop understanding you :-)
You don't have to set the timer.
You have to catch and process the event "opening of a new bar".
However, every 5th question "about Expert Advisors" is devoted to this question, and each of them has an answer - just browse the topic
Maybe, I'm expressing myself incorrectly, but isn't it better to wait for the necessary moment, especially since it is possible that the price does not change and the bars are closed? Is it possible to repeat OnStart indefinitely?
Static variables are not reinitialised when changing input parameters, graph period, etc.
Isn't there some sort of ear trick to reinitialise them forcibly? Longer path roughly imagined, is there not a simple and short one?