[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 21

 
You don't need to resize it afterwards, just declare it and make sure it's big enough before you put the data into it.
 
   
   
   ArrayResize(SMA,limit);     //--- Размер различный задавал от 1 до Bars 
   ArrayInitialize(SMA,0);
   for(i=0;i<limit;i++){// bla bla bla
   SMA[i]=...........; // --- Заполнение массива.
   MA1[i]=iMAOnArray(SMA,0,8,0,0,0); //----MA1 буферный.
 
OK, got it, thanks. But how do I determine size sufficiency if, for example, I need only one variable in the array? Is it necessary to initialize 0?
 
Fox_RM:

I usually do this with a non-buffered one.

To calculate iMAOnArray the 1st value is NOT enough!!! Read about this function (I gave a link in my previous post).
 
In order to get one value of average you need to analyse period of input data, so size of initial array SMA[] should not be less than limit+period - so I made a mistake here ArrayRezize(SMA,limit+period); you do not need to initialize, anyway you will not go further than necessary.
 

how the indicator in the cycle defines the start of a new day, I have it like this:

if(TimeDay(Time[i]) != TimeDay(Time[i+1]));// новый день
does anyone have a better design than this?
 
It's all clear. Thank you all!
 
Can you tell me where I can get the source code for autoregression, extrapolation, etc. etc., not necessarily in mql.
 

Hello! My goal is to transfer the indicator by creating a function into the EA.

The first step, which is the creation of the function, is done. But the next one - testing - does not work.

The indicator draws channels. It has 4 buffers and a lot of variables. I have placed it all in the function.

But when creating a test Expert Advisor to make sure that it works exactly by comparing the indicator and my function, I cannot achieve compilation.

Constant errors of external variables, which were not there when I created the function, have popped up in the EA.

Please give me some advice or a link to an example. I have used GODZILLA's articles, but his examples are different from mine.

 
Help me write a condition that will cause the EA to multiply the lot by two times after opening n orders