You got to dimension the array before to use it, otherway it will give you zeros.
limit=AllBars-ttPeriod-1;
ArrayResize(Array1, limit);
ArrayResize(Array2, limit);
for(i=0; i<limit; i++) {
. . . .
limit=AllBars-ttPeriod-1;
ArrayResize(Array1, limit);
ArrayResize(Array2, limit);
for(i=0; i<limit; i++) {
. . . .
Dear Turcol,
Thank you, it works fine now :)
Is there a place where i can see a language reference for MQ4?
Thanks again.
Regards
Alejandro Galindo
Thank you, it works fine now :)
Is there a place where i can see a language reference for MQ4?
Thanks again.
Regards
Alejandro Galindo
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
// Channel limit=AllBars-ttPeriod-1; for(i=0; i<limit; i++) Array1[i]=iMA(NULL,0,21,0,MODE_EMA,PRICE_CLOSE,i); for(i=0; i<limit; i++) Array2[i]=iMAOnArray(Array1,Bars,5,0,MODE_EMA,i); for(i=0; i<limit; i++) { Print(Array1[i]); // HERE THIS ONLY PRINTS CERO // EVEN WHEN I ASSIGN A VALUE DIRECTLY // TO THE ARRAY Array3[i]=iMAOnArray(Array2,Bars,1,0,MODE_EMA,i); Value1 = 100*Array3[i]; Value2 = Array3[i] ; if (Value2 != 0) TS = Value1/Value2; else TS = 0 ; UC = Highest(NULL, 0, MODE_HIGH, i+21, i); LC = Lowest(NULL, 0, MODE_LOW, i+21, i); if (TS < 0) Plot3[i]=UC; else if (TS > 0) { Plot4[i]=UC; } if (TS < 0) Plot5[i]=LC; else if (TS > 0) { Plot6[i]=LC; } }if i do a simple example it dosent work too:
limit=Bars-1; for(i=0; i<limit; i++) { Array1[i] = i*1.5; Print(Array1[i]); // PRINTS ONLY CERO }Any advice on how to solve this problem?
Thanks
Alejandro Galindo