MT4 Language Question

 

Hello

..

in fact, I have noticed that no trades could be happen with the following code example:

      if(Close[0] < PreDefPriceBuy)
         BuyExecute();


while replacing the < with the <= would allow trading normally

      if(Close[0] <= PreDefPriceBuy)
         BuyExecute();

 ..

note that the < condition is the needed one (not the <=)
 
Mohammad Soubra:
      if(Close[0] < PreDefPriceBuy)
         BuyExecute();


Please show the section of code where you set the value of PreDefPriceBuy
 
Close[0]

Is the last bar and will usually normally always be open Mohammad.

It does not have a fixed close price like all the other older bars.

As soon as it closes a new zero bar is opened and there will be a bar shift and new candle formation starts.

So the Close price of the last bar will usually be the same as the latest market quote.
 
Marco vd Heijden:
Close[0]

Is the last bar and will usually normally always be open Mohammad.

It does not have a fixed close price like all the other older bars.

As soon as it closes a new zero bar is opened and there will be a bar shift and new candle formation starts.

So the Close price of the last bar will usually be the same as the latest market quote.
Hey Marco! I know
 
honest_knave:
Please show the section of code where you set the value of PreDefPriceBuy
In inputs of the expert
User could enter the price manually like 1.1234
 
Mohammad Soubra:
In inputs of the expert
User could enter the price manually like 1.1234
Without seeing more of the code to understand what is going on, all I can suggest is to print the values of Close[0] and PreDefPriceBuy to see if something odd is happening.
 
Mohammad Soubra:

Hello

..

in fact, I have noticed that no trades could be happen with the following code example:

      if(Close[0] < PreDefPriceBuy)
         BuyExecute();


while replacing the < with the <= would allow trading normally

      if(Close[0] <= PreDefPriceBuy)
         BuyExecute();

 ..

note that the < condition is the needed one (not the <=)
honest_knave:
Please show the section of code where you set the value of PreDefPriceBuy
Mohammad Soubra:
In inputs of the expert
User could enter the price manually like 1.1234
In that case, the problem will be elsewhere in your code. Otherwise it would mean that you have discovered a serious bug.

Does the BuyExecute() get executed and fails? You do have checks in place ?
 
Mohammad Soubra: note that the < condition is the needed one (not the <=)

Understand the links in The == operand. - MQL4 forum Ask >= OOP+n could be true because of round off and Ask >= OOP+n - 0.000005 and could be false at Ask >= OOP+n + 0.000005.

If the equality is important use (must be true at Ask == OOP+n) Use "definitely >=": Ask - (OOP+n) > -_Point/2. // Note the minus

If the equality is important use (must be false at Ask == OOP+n) Use "definitely >" Ask - (OOP+n) > _Point/2.

If the equality is not important (false when equal or true when not) just use Ask > OOP+n

 
honest_knave:
Without seeing more of the code to understand what is going on, all I can suggest is to print the values of Close[0] and PreDefPriceBuy to see if something odd is happening.
extern double  PreDefPriceBuy       = 0;        //Predetermined Price Buy-Only (Support)

!!!!

By editing from the user then the 0 should be a manually typed price 

Reason: