Where do you declare the array size for your arrays?
I see this but it is incomplete
double array1[][6];
double array2[][6];
double array11[];
Where do you declare the array size for your arrays?
I see this but it is incomplete
double array1[][6];
double array2[][6];
double array11[];
that is how i declare the arrays, everything works, just can't store inot new array. Why do you say that is incomplete?
"that is how i declare the arrays, everything works, just can't store inot new array. Why do you say that is incomplete?"
Oh. Everything works, it just doesn't work. I understand.
How big are your arrays? Are they big enough to hold the values you want to copy into them?
"that is how i declare the arrays, everything works, just can't store inot new array. Why do you say that is incomplete?"
Oh. Everything works, it just doesn't work. I understand.
How big are your arrays? Are they big enough to hold the values you want to copy into them?
This code is from a correlation indicator, that does work, the arrays are big enough to hold all the values from pair1 and pair2. I'm modifying the code to divide the pairs first and then perform correlation. The original indicator is performing correlation on pair1 and pair2. With this modification, i want pair1/pair2 go into an array, pair2/pair3 go into another array. After, the arrays will be passed to the correlation instructions(original code) to perform coefficient calculation.
In your sample there is no specification for the size of the arrays. The results wil not always be what you want.
In your sample there is no specification for the size of the arrays. The results wil not always be what you want.
Well, for now the results are still zero, regardless if i specify the array size.
In your sample there is no specification for the size of the arrays. The results wil not always be what you want.
Well, for now the results are still zero, regardless if i specify the array size.
HAHAH, ALRIGHT, I GOT IT TO WORK,
THIS IS THE INSTRUCTION TO ADD TO THE INDICATOR
SetIndexBuffer(1,array11);
that was the problem............................
double array1[][6]; ArrayCopyRates(array1, Pair1, NULL); count=ArraySize(array1);
ArraySize Returns the count of elements contained in the array. For a
one-dimensional array, the value to be returned by the ArraySize
function
is equal to that of ArrayRange(array,0).
But array1 is a 2D array, you want the count of rows, use ArrayRange
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i'm trying to take two instruments and store them into array1 and array2, divide them (array1/array2) and store them into another array11.
Indicator code:
Pair1="EURUSD";
Pair2="GBPUSD";
double first;
double array1[][6];
double array2[][6];
double array11[];
shift=1;
if(x!=iTime(NULL, 0, 0)) shift=limit;
ArrayCopyRates(array1, Pair1, NULL);
ArrayCopyRates(array2, Pair2, NULL);
count=ArraySize(array1);
koht=4;//close price
while(shift>0)
{
for(int c=1; c<count; c++)
{
array11[c]=(array1[shift+c][koht])/(array2[shift+c][koht]);
first=(array1[shift+c][koht])/(array2[shift+c][koht]);
}
shift--;
}
Problem with storing array1/array2 into array11, when i specify for array11 to print, i get zeros in all.
When i just use double and not array, the variables show up, but are not stored into array.
how do i divide array1 by array2 and store the variables in array11? I looked on mql4.com>documentation>array functions, and found nothing that discusses storing array variables into arrays.