MA of the MACD Signal - page 2

 

your welcome Dropje,

I missed one logic, try this one, see if it came out different. Added : This is the correct one. i.e. fill the first array first, then the second can calculate on it.

int fnMACD_Signal()
{
   int iMACD_Signal; 
   double macd[], maOnMacd[];

      double dMACD = iMACD(NULL,0,10,20,0,PRICE_CLOSE,MODE_SIGNAL,0);

      for(int i=0; i<= 20+1; i++)
      {
       macd[i] = iMACD(NULL,0,10,20,1,PRICE_CLOSE,MODE_SIGNAL,i);
      }

      for(int i=0; i<= 7+1; i++)
      {
       maOnMacd[i] = iMAOnArray( macd,0,7,0,MODE_EMA,i);
      }
   
      if(dMACD > maOnMacd[0]) iMACD_Signal = 1;
      else if(dMACD < maOnMacd[0]) iMACD_Signal = 2;
      else Print(" dMACD & maOnMacd is dead equal.)";
      return(iMACD_Signal);
}

Good luck

cameo

 
ı try to it but always return zero. I dont understand why. ı tried a lot of example with different value.
 
int ArrayResize( object &array[], int new_size)
Sets a new size for the first dimension. If executed successfully, it returns count of all elements contained in the array after resizing, otherwise, returns -1, and array is not resized.
Note: Array declared at a local level in a function and resized will remain unchanged after the function has completed its operation. After the function has been recalled, such array will have a size differing from the declared one.
Reason: