MACD Cross

 

Hi Guys,

I know this is probably a stupid question to some of you, but I am new to mq4 programming.

My strategy is to use MACD on a higher time frame like on the 1H chart. and then trade overbought and oversold with Stochastic on the 15M chart.

If MACD crosses the Signal and MACD > Signal then the trend is Bullish.

My question is:

How do I get a 6 digit value from the iMACD indicator to a double. The double only rounds to the last 4 digits. This is not sensitive enough. Is there maybe another way of doing this...a better way?

Here is my code:

string MACD_Function(int MACD_Time_Frame)

{

double My_MACD = 0;

double My_Signal = 0;

double My_Histogram = 0;

string MACD_Trend = "";

My_MACD= iMACD(NULL,MACD_Time_Frame,FastEMA,SlowEMA,SignalSMA,PRICE_OPEN,MODE_MAIN,0); //Get MACD value

My_Signal = iMACD(NULL,MACD_Time_Frame,FastEMA,SlowEMA,SignalSMA,PRICE_OPEN,MODE_SIGNAL,0); //Get Signal

if(My_MACD > My_Signal)

MACD_Trend = "BULL"; //Bullish Trend

if(My_MACD < My_Signal)

MACD_Trend = "BEAR"; //Bearish trend


return(MACD_Trend); //Returns the MACD trend on the higher chart

}

 
I have the same problem... Did you manage to get a solution for this?
 
capstin:
I have the same problem... Did you manage to get a solution for this?
What makes you think you are getting 4 digits ?
 
   int d;
   if(Digits == 2) d=4;
   if(Digits == 3) d=3;
   if(Digits == 4) d=2;
   if(Digits == 5) d=1;
   IndicatorDigits(Digits+d);
   int i,x,d;
   for(i=2,x=4;i<=5;i++,x--)  
    {
     if(Digits == i) d=x;
    }
   IndicatorDigits(Digits+d);