MTF MACD and normalizing

 

Hi,

I am programming an indicator table which shows my the gradient of the macd.

Here I have a few problems:

 for(x=0;x<9;x++)
  {
double MACD_gradient = (iMACD(Symbol(),period[x],FastMACD,SlowMACD,SignalMACD,PRICE_CLOSE,MODE_MAIN,Bar_last+1)-
                        iMACD(Symbol(),period[x],FastMACD,SlowMACD,SignalMACD,PRICE_CLOSE,MODE_MAIN,Bar_now))/(Bar_last+1-Bar_now); 
...
  }

As the result of the MACD_gradient I show different widgets.

With other Indicator it works but not with the MACD. But I don't know why. How can I normalize the MACD?


I also want to show the intercept point of two MAs in H1:

   iTF = iBarShift(NULL, PERIOD_H1, Time[i]); 

double Indikator2_0 = iMA(NULL,PERIOD_H1,MA2_Periode,0,MA2_Methode,MA2_AppliedPrice,iTF);
double Indikator2_1 = iMA(NULL,PERIOD_H1,MA2_Periode,0,MA2_Methode,MA2_AppliedPrice,iTF+1);

double Indikator3_0 = iMA(NULL,PERIOD_H1,MA3_Periode,0,MA3_Methode,MA3_AppliedPrice,iTF);
double Indikator3_1 = iMA(NULL,PERIOD_H1,MA3_Periode,0,MA3_Methode,MA3_AppliedPrice,iTF+1);
 
   if(Indikator2_0 <= Indikator3_0 && Indikator2_1 >= Indikator3_1) 
   {
    ...
   }

Also this interception point changes when I change my Timeframe. I thought this should be the same every timeframe!

 
for(x=0;x<9;x++)
  {
double MACD_gradient = (iMACD(Symbol(),period[x],FastMACD,SlowMACD,SignalMACD,PRICE_CLOSE,MODE_MAIN,Bar_last+1)-
                        iMACD(Symbol(),period[x],FastMACD,SlowMACD,SignalMACD,PRICE_CLOSE,MODE_MAIN,Bar_now))/(Bar_last+1-Bar_now); 
...
  }

What are you doing when .......

The loop will end with one value for MACD_gradient and that is for the last calculated period[9] (Weekly?? )

Also we don't have a definition for (Bar_last+1-Bar_now)

 
sunshineh:


I also want to show the intercept point of two MAs in H1:

Also this interception point changes when I change my Timeframe. I thought this should be the same every timeframe!

If you use any timeframe in the calculations other than H1 (for example the chart timeframe) then it will possibly change . . . you don't show your code so I can't be certain though.
Reason: