Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1222

 

Good afternoon!

How do I reset the array structure?

struct PosFib
  {
   double            praceMA;
  };

PosFib BP[];

Tried this but it doesn't seem to work!

   CountBP=0;
   ArrayResize(BP,CountBP); // добавить счетчик на заполненность

Any other possibilities?

 
Top2n:

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

 
Artyom Trishkin:

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.

 
Alexey Viktorov:

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!

 
Is there a trade copier on the same Roboforex broker with the same accounts in terms of parameters that can be installed discreetly on mt 5 on the master account? The master account trades a paid robot from a remote server. We should spread these signals on three more accounts. I don't want them to notice that the signals were sent to other accounts.
 
What does "invalid ex4 file (7)" and "global initialisation failed" mean?
 
Maxim Kuznetsov:

- 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'll change ask to bid and vice versa. OnTick will not work for me, because I need to constantly 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 when opening an EA?
 
VIX XIV:
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

 
Maxim Kuznetsov:

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?