Hey all, first post...I have searched the forums and the documentation to try and figure out why this is not working. Here is my code:
The line in case 0:
Does not properly assign the value in StoArray element j to IndMatTF1. I have tried checking all elements and nothing all zeros all the time even when StoArray[j] is not a zero.
Any help would be greatly appreciated.
Thanks,
J
I figured it out, so just in case anyone else runs into this:
Apparently trying to assign an array element to another array element doesn't work so I had to assign as follows:
BarInd = BarCount[j]; ArrayResize(IndMatTF1,BarInd); b = StoArray[j]; IndMatTF1[BarInd,0] = b;
Hope this helps someone else avoid a headache!
J
Apparently trying to assign an array element to another array element doesn't work [...]
That should work fine, you must have a logic error. For example this works just fine:
double a[]={1,2}; double b[]={3,4}; a[0]=b[1]; Print("a[0]=",a[0]);
That should work fine, you must have a logic error. For example this works just fine:
Thanks for the response gordon. Yeah I am able to get a statement like what you presented to work, what I had done was use array1(element1) as an index for another array i.e. array2(array1(element1),0) which then had an element from array3 assigned ==>
array2(array1(element1),0) = array3(element1);
I'm not sure if there was an error in how I was typing in the indices for array2 or if it doesn't allow a variable array element to be used as an index, eitherway it's working now!
Thanks,
J
[...] what I had done was use array1(element1) as an index for another array i.e. array2(array1(element1),0) which then had an element from array3 assigned [...]
It should still work fine as long as the array used as an index for another array is of type int (otherwise it won't compile, with the error "array index is to be an integer"):
double a[]={1,2}; double b[]={3,4}; int c[]={0,1}; a[c[1]]=b[1]; Print("a[1]=",a[1]);
double IndMatTF1[1][1]; ... BarInd = BarCount[j]; ArrayResize(IndMatTF1,BarInd); IndMatTF1[BarInd,0] = StoArray[j];
- You might try
double IndMatTF1[][1];
- BarCount[j] is zero in the posted code. move the increment up before the ArrayResize. or use
ArrayResize(IndMatTF1,BarInd+1);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey all, first post...I have searched the forums and the documentation to try and figure out why this is not working. Here is my code:
The line in case 0:
IndMatTF1[BarInd,0] = StoArray[j];
Does not properly assign the value in StoArray element j to IndMatTF1. I have tried checking all elements and nothing all zeros all the time even when StoArray[j] is not a zero.
Any help would be greatly appreciated.
Thanks,
J