My indicators, and issues I have with iCustom(...) - page 2

 

Though my indicators are working, my EA is still not calling the values.

iCustom

PMB             = iCustom(NULL,0,"Pressurised Market Buy(Downward Bias)",0,0);
PMS             = iCustom(NULL,0,"Pressurised Market Sell(Upward Bias)",0,0);

Indicator

//+------------------------------------------------------------------+
//|                       Pressurised Market Buy (Downward Bias).mq4 |
//|                                                       Luciano. E |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Luciano .E"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
double MBMPD[];
extern int InPeriod = 20;
double pips;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
  double ticksize = MarketInfo(Symbol(), MODE_TICKSIZE);
  if (ticksize == 0.00001 || ticksize == 0.001)
  pips = ticksize*10;
  else pips =ticksize;
  
   SetIndexBuffer(0,MBMPD);
   SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2,Blue);
   SetIndexLabel(0,"Market Bias/Market Pressure Difference");
   SetIndexDrawBegin(0,InPeriod+3);   
   
   
  
   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
   
   int counted_bars=IndicatorCounted();
   if(counted_bars<0)return(-1);
   if(counted_bars>0)counted_bars--;
   int uncountedbars=Bars-counted_bars; 
   
   
 


//- ---

for(int i=0;i<uncountedbars;i++)
    
   {   
     
    
     
     if((iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_CLOSE,i+1)-iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_OPEN,i+1))>=1*pips && (iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_CLOSE,i+2)-iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_OPEN,i+2))>=1*pips)
     {                                        
                            ////////////////////////////////////////////////////////////Rate of Rate of Increase Current///////////////////////////////////////////////////////////////                           
    //          Rate of Increase Current                                                                       Rate of Increase Previous                                                                                                                                                      
     MBMPD[i]=((iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_CLOSE,i)-iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_OPEN,i))/(iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_CLOSE,i+1)-iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_OPEN,i+1)))
     
     - //Minus
                           ////////////////////////////////////////////////////////////Rate of Rate of Increase Previous///////////////////////////////////////////////////////////////        
     //        Rate of Increase Previous                                                                           Rate of Increase Historical
              ((iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_CLOSE,i+1)-iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_OPEN,i+1))/(iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_CLOSE,i+2)-iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_OPEN,i+2)));
     }
     else
     { 
     MBMPD[i]=(iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_CLOSE,i)-iMA(NULL,0,InPeriod,0,MODE_SMMA,PRICE_OPEN,i))/1; 
     }
     
     
   }


   return(0);
  }
//+------------------------------------------------------------------+

Keep getting the value 0 when I print in my EA.

 
MetaNt:

Though my indicators are working, my EA is still not calling the values.

iCustom

Indicator

Keep getting the value 0 when I print in my EA.

Get into the habit of checking the Experts tab for errors . . . your iCustom() call is for this Indicator . . . "Pressurised Market Buy(Downward Bias)" your posted code says the file name is "Pressurised Market Buy (Downward Bias).mq4" the names differ by a space after Buy and (Downward

My test code using your iCustom() call with the correct Indicator name works just fine . . .
 
RaptorUK:
Get into the habit of checking the Experts tab for errors . . . your iCustom() call is for this Indicator . . . "Pressurised Market Buy(Downward Bias)" your posted code says the file name is "Pressurised Market Buy (Downward Bias).mq4" the names differ by a space after Buy and (Downward

My test code using your iCustom() call with the correct Indicator name works just fine . . .

Once again I feel like a time waster. Thanks and fixed.
 
MetaNt: Keep getting the value 0 when I print in my EA.
  1. Did you call GetLastError and find out why?
  2. PMB             = iCustom(NULL,0,"Pressurised Market Buy(Downward Bias)",0,0);
    
    //|                       Pressurised Market Buy (Downward Bias).mq4 |
    
    The indicator name in iCustom doesn't match the comment in the indicator code. What is the actual file name?
 
WHRoeder:
  1. Did you call GetLastError and find out why?
  2. The indicator name in iCustom doesn't match the comment in the indicator code. What is the actual file name?

Yeah it didn't, there was even another issue that was preventing my EA from acting on the values received from the indicator but I managed to deal with that one without bothering anyone, so that's a positive. Thanks for all the help.
Reason: