Handling 3 & 4 digits

 

Hi,


I didn't find any good doc about how to handle 3 & 4 digits for my EAs. 

My code looks like this:

 double buySL = Ask - SL * _Point;

 double buyTP =  Ask + TP * _Point;      


int openBuy(double buySL = 0, double buyTP = 0) {

   return OrderSend(_Symbol,OP_BUY ,lots(),Ask,0,buySL,buyTP,DoubleToString(lots()),magic_number,0,clrIndigo);

}

What should I add or remove?

Any help would be appreciated! thanks.


 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2.  double buySL = Ask - SL * _Point;
     double buyTP =  Ask + TP * _Point;      
    
    You buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the spread on close.
    1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not the Ask. Your SL is shorter by the spread and your TP is longer.
    2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask reaches it. To trigger at a specific Bid price, add the average spread.
                MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
    3. The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (Control-O) → charts → Show ask line.)

  3. Arthur Hatchiguian: I didn't find any good doc about how to handle 3 & 4 digits for my EAs.
    A PIP is not a Point.
              What is a TICK? - MQL4 programming forum

    Using Point means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points,) and metals. Compute what a PIP is and use it, not points.
              How to manage JPY pairs with parameters? - MQL4 programming forum
              Slippage defined in index points - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forum

Reason: