What is meaning of these codes?

 

Hello

What is meaning of these codes? 

I don't understand Red and bold parts.

1- what is variables started with ?

2- what is _mtfCall ?

3- what is meaning of this statement : double PP=(  )? : ;

If possible, please send me documents or references to understand these codes. 


MACDHistB1[i]=(MACDHist[i]>0 && MACDHist[i+1]>MACDHist[i])?MACDHist[i]:0;

double PP=(_Digits==5 || _Digits==3 )?_Point*10:_Point;

#define _mtfCall(_buff,_ind) iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,........., _buff,_ind)


 
  1. Variable names that start with an underscore.
  2. A macro. Macro substitution (#define)
  3. Ternary Operator ?:
 
KSforex:

Hello

What is meaning of these codes? 

I don't understand Red and bold parts.

1- what is variables started with ?

2- what is _mtfCall ?

3- what is meaning of this statement : double PP=(  )? : ;

If possible, please send me documents or references to understand these codes. 


MACDHistB1[i]=(MACDHist[i]>0 && MACDHist[i+1]>MACDHist[i])?MACDHist[i]:0;

double PP=(_Digits==5 || _Digits==3 )?_Point*10:_Point;

#define _mtfCall(_buff,_ind) iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,........., _buff,_ind)



3-

if (_Digits==5 || _Digits==3)
    double PP= _Point*10;
else
    double PP= _Point;
 

And what is meaning of this code ?

string test = (((state & 1)== 1)?"DN":"UP");

what is different with this code 

string test = (((state)== 1)?"DN":"UP");


I dont understand this part  ->  & 1



This is the original  code:

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- enable CHART_EVENT_MOUSE_MOVE messages
   ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,1);
  }
//+------------------------------------------------------------------+
//| MouseState                                                       |
//+------------------------------------------------------------------+
string MouseState(uint state)
  {
   string res;
   res+="\nML: "   +(((state& 1)== 1)?"DN":"UP");   // mouse left
   res+="\nMR: "   +(((state& 2)== 2)?"DN":"UP");   // mouse right 
   res+="\nMM: "   +(((state&16)==16)?"DN":"UP");   // mouse middle
   res+="\nMX: "   +(((state&32)==32)?"DN":"UP");   // mouse first X key
   res+="\nMY: "   +(((state&64)==64)?"DN":"UP");   // mouse second X key
   res+="\nSHIFT: "+(((state& 4)== 4)?"DN":"UP");   // shift key
   res+="\nCTRL: " +(((state& 8)== 8)?"DN":"UP");   // control key
   return(res);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
   if(id==CHARTEVENT_MOUSE_MOVE)
      Comment("POINT: ",(int)lparam,",",(int)dparam,"\n",MouseState((uint)sparam));
  }



 I didn't find anything here Ternary Operator ?:

Thanks for help

Ternary Operator ?: - Operators - Language Basics - MQL4 Reference
Ternary Operator ?: - Operators - Language Basics - MQL4 Reference
  • docs.mql4.com
, the third operand - "expression3" is performed. The second and third operands, i.e. "expression2" and "expression3" should return values of one type and should not be of void type. The result of the conditional operator execution is the result of expression2 or result of the expression3, depending on the result of expression1. Operator Use...
 
KSforex: I dont understand this part  ->  & 1
string test = (((state & 1)== 1)?"DN":"UP"
I didn't find anything here Ternary Operator ?:
  1. Take state, isolate the least significant bit (i.e. the value one,) see if it is set (i.e. is one.)
  2. Read the manual again. If its odd, set test="DN", otherwise set test="UP"
Reason: