3494 


Arav007: There is nothing wrong "with such declaration". The problem, is you didn't size it later. Either explicitly, or automatically as a indicator buffer. Look again at your " I have seen many code"
Yet if you feel it's wrong, please show the right one. Thanks 

WHRoeder: There is nothing wrong "with such declaration". The problem, is you didn't size it later. Either explicitly, or automatically as a indicator buffer. Look again at your " I have seen many code"
int start() { sLog_Start = "START  start() function"; double Signal_Stochastic[];//....................................................................................L1 sLog_Start = sLog_Start + sNL + " Start  Set and Get MA values"; ArraySetAsSeries(Signal_Stochastic, true);//................................................................L2 for( i=0; i<Bars; i++) Signal_Stochastic[i] = iStochastic(NULL,0,75,5,5,MODE_SMA,0,MODE_SIGNAL,i);//...................................L3 double MA_Signal_Sto = iMAOnArray(Signal_Stochastic, 0,20,0,MODE_SMA,0);//...................................L4 sLog_Start = sLog_Start + sNL + " Signal Sto's Value=" + Signal_Stochastic[0];..............................L5 sLog_Start = sLog_Start + sNL + " MA_Signal_Sto's Value=" + MA_Signal_Sto; if (Signal_Stochastic>MA_Signal_Sto) { Buy; } if (Signal_Stochastic<MA_Signal_Sto) { Sell; } return (0); } At Line 1(L1): I have declared an array called 'Signal_Stochastic' with indefinite array size. At L2: Used AraySetAsSeries() function for Right to Left counting. At L3: Defined the Signal_Stochastic Array with a size of 'i' where 'i' keeps increasing from '0' to last bar available. The value of Signal Line of the Stochastic is getting calculated at every bar starting from the current bar to backward. At L4: Define Here this MA is getting fed from the Signal Line of Stochastic. But calculating Value of MA only for current bar. At L5: Tried to see the value of Signal Line for current bar. But I know I have faults in understanding the code. 
3494 
Arav007:
Yet if you feel it's wrong, please show the right one. Thanks
//++ // Array check.mq4  // GumRai  //  //++ #property copyright "GumRai" #property link "" #property version "1.00" //#property strict //++ // Script program start function  //++ void OnStart() { // double Signal_Stochastic[]; int array_size = 5; for(int index=0; index < array_size; index++) { Signal_Stochastic[index]=index; Alert("index = ",index," Signal_Stochastic[",index,"] = ",Signal_Stochastic[index]); } } //++ All the alerts will show zero Add this single line of code to Resize the array ArrayResize(Signal_Stochastic,array_size);
//++ // Array check.mq4  // GumRai  //  //++ #property copyright "GumRai" #property link "" #property version "1.00" //#property strict //++ // Script program start function  //++ void OnStart() { // double Signal_Stochastic[]; int array_size = 5; ArrayResize(Signal_Stochastic,array_size); for(int index=0; index < array_size; index++) { Signal_Stochastic[index]=index; Alert("index = ",index," Signal_Stochastic[",index,"] = ",Signal_Stochastic[index]); } } //++ And you will see that the Alerts are as expected If you uncomment #property strict, you will see the alerts as doubles 
3494 
Arav007:
At Line 1(L1): I have declared an array called 'Signal_Stochastic' with indefinite array size. At L2: Used AraySetAsSeries() function for Dynamic object of the Array. At L3: Defined the Signal_Stochastic Array with a size of 'i' where 'i' keeps increasing from '0' to last bar available. The value of Signal Line of the Stochastic is getting calculated at every bar starting from the current bar to backward. At L4: Define Here this MA is getting fed from the Signal Line of Stochastic. But calculating Value of MA only for current bar. At L5: Tried to see the value of Signal Line for current bar. But I know I have faults in understanding the code. asff But nowhere have you sized the array 


3494 
double Signal_Stochastic[];
You declare your array, but you don't size it