[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 89

 
keep87:
not possible

it is possible))

For example, you could have the EA load the array into global variables of the terminal and then read it from there.

 
alsu:
Decide what you want the output to be. If the value of the machine is 5 bars backwards, then

or identical

If so,

it will always be EMPTY_VALUE, as there is no shifted wrist on these bars

Got it, thanks!
 
alsu:
Best of all, don't bother with the shifts in the EA, just take the shift 0 and the number of the bar you want.
I checked with the tester now, it turns out that the trade opens 5 candles after crossing the moving averages, and that's not the case... I figured out what you can do, move the other MA 5 candles forward, then the signal is correct...)
 
ierehon:
I checked now with the tester, it turns out that the trade opens 5 candles after the moving averages have crossed, and that's not the same... I figured out what to do, move another MA 5 candles forward, then the signal is correct...)

it's the same thing))

zero bar of the MA shifted by 5 bars to the right = 5th bar of the unshifted MA

 
keep87:
cannot. It is possible to manually score data from array to array inside EA if it does not change from optimization to optimization, for the time of tests.
But in this case, MT will have to read the array from the file each time(?), but not from a separate one, but from the code.
- Will there be any gain in this case?
 
alsu:

it is possible))

For example, you could have the Expert Advisor load the array into the terminal's global variables and then read from there.

The array elements can be from several dozens to several hundreds and for each variable must be declared beforehand.
It will be rather difficult to implement (of course, the task is not trivial, either).
 
chief2000:
Array elements can be several dozens to several hundreds, and a variable must be declared for each one beforehand.
It's a bit complicated to implement (of course, the task is not trivial either).

so what? Handle variables in the loop in the same way you would handle array elements. Example usage:

double a[];
int n;

...
ArrayResize(a,n);
...

//запись массива в глобальные переменные

string name;
for(i=0;i<n;i++)
{
   name = StringConcatenate("__ARRAY_",i);
   GlobalVariableSet(name,a[i]);
}

//чтение в массив из глобальных

int gv = GlobalVariablesTotal();
int index;

for(i=0;i<gv;i++)
{
   name = GlobalVariableName(i);
   if(StringFind(name,"__ARRAY_")==0)
   {
      index = StrToInteger(StringSubstr(name,8));
      if(index>=0&&index<n) a[index]=GlobalVariableGet(name);
      
      //опционально - если хотим очистить список
      //GlobalVariableDel(name);
   }
}


it couldn't be simpler))

 
alsu:

So what? Handle variables in the loop the same way you would handle array elements. Example usage:

it couldn't be simpler))

In my memory, I've handled a couple thousand variables in this way, and I haven't noticed any slowdowns. For larger quantities (hundreds of thousands of items or more), I usually try to use MySQL.
 
alsu:
In my memory I've worked in this way with a couple thousand variables, and haven't encountered any lags. For larger quantities (hundreds of thousands of items or more), I usually try to use MySQL.
THANK YOU VERY MUCH!
 

Can you advise me, there is a csv file with data in the format 1.33027; 1.33023 and so on.

Then read this file but for some reason the data are read with a 4-digit accuracy and I need to with 5.

Read in different ways and

FileReadString и FileReadDouble и FileReadInteger

does not help