functions and function calls - page 2

 

Regarding your MACD Up 

why is faster and slower

double      faster = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,3), //MODE_MAIN
            slower = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,3); //MODE_SIGNAL

 

 declared and assigned a value globally? They should be assigned a value in start()

 
2cent:

The statement:

 if(function()) .. 

will only evaluate to true if function() returns true.

 

Also use OnTick() instead of start().. (possibly this will sort some probs)

 

 


Is void OnTick() the new start() or is there a new start() since build 600 ?
 
GumRai:

Regarding your MACD Up 

why is faster and slower

 

 declared and assigned a value globally? They should be assigned a value in start()

I'm confused
 
 
Agent86:
I'm confused
 


If you declare and assign a value globally the value will always stay the same unless it is re-assigned a value locally

You should be doing something like this

 
int start()
  {
  double faster = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,3); //MODE_MAIN
  double slower = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,3); //MODE_SIGNAL
  
   if(macdup(faster,slower))
      {
      //return;
      }
   return(0);
  }


bool macdup(double faster,double slower)
   {
      if(faster > slower)
         {
         Print(" MACD UP");
         return(true);
         }
      else
      Print(" No Up Signal");
      return(false);
    //return(true);  
   }
     
bool macddown(double faster,double slower)
   {
      if(faster < slower)
         {
         Print(" MACD DOWN");
         return(true);
         }
      else
      Print(" No Down Signal");
      return(false);
   }    
   
I don't know what is happening, sometimes SRC are getting lost
Reason: