Problems with a calculation

 
Good morning, I have a problem and need help please.
I recover ...
open = iOpen (Symbol (), PERIOD_M1, 1);
close = iClose (Symbol (), PERIOD_M1, 1);

I need open and close with 5 decimal places, but I come with 4 decimal places and if the string step puiedo not operate with them, and I need you to put the result subtract without decimal numbers:

open = 1.61256
close = 1.61154

result = 0.00102 (NO)

I need result = 102

Can anyone help me to make it easy?

thanks
 
jugivi:
Good morning, I have a problem and need help please.
I recover ...
open = iOpen (Symbol (), PERIOD_M1, 1);
close = iClose (Symbol (), PERIOD_M1, 1);

I need open and close with 5 decimal places, but I come with 4 decimal places and if the string step puiedo not operate with them, and I need you to put the result subtract without decimal numbers:

open = 1.61256
close = 1.61154

result = 0.00102 (NO)

I need result = 102

Can anyone help me to make it easy?

thanks
result = 0.00102 (NO)/Point = 102
 
jugivi:
need open and close with 5 decimal places, but I come with 4 decimal places and
I need result = 102
  1. iOpen/iClose return a double, INFINITE decimal places. RTFM Print/Comment/Alert and then the link to DoubleToStr.
    string  PriceToStr(double p){   return( DoubleToStr(p, Digits) );              }
    string  DeltaToPips(double d){
        if (d > 0)  string sign = "+";  else    sign = "";
        double pips = d / pips2dbl;
        return( sign + DoubleToStr(pips, Digits.pips) );                           }
    

  2. int result = (close-open) / pips2dbl;
    Your EA must adjust for 4/5 digit brokers. Pips (tp, sl) and Points (Slippage) EA's must adjust for ECN brokers
    //++++ These are adjusted for 5 digit brokers.
    int     pips2points;    // slippage  3 pips    3=points    30=points
    double  pips2dbl;       // Stoploss 15 pips    0.015      0.0150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){                                             
         if (Digits % 2 == 1){      // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    //---- These are adjusted for 5 digit brokers.
        /* On ECN brokers you must open first and THEN set stops
        int ticket = OrderSend(..., 0,0,...)
        if (ticket < 0)
           Alert("OrderSend failed: ", GetLastError());
        else if (!OrderSelect(ticket, SELECT_BY_TICKET))
           Alert("OrderSelect failed: ", GetLastError());
        else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0))
           Alert("OrderModify failed: ", GetLastError());
         */
    
 
Thanks.
 
You should use Point in your calculation to get exact pip.
 
dineshydv: You should use Point in your calculation to get exact pip.
A point is NOT a pip on a 5 digit broker.
 
William Roeder:
  1. iOpen/iClose return a double, INFINITE decimal places. RTFM Print/Comment/Alert and then the link to DoubleToStr.
  2. Your EA must adjust for 4/5 digit brokers. Pips (tp, sl) and Points (Slippage) EA's must adjust for ECN brokers

    many thanks for where these instructions on  iOpen/Close are leading to with the since my broker is asking for the SL and TP in POINTS on the EA settings with the Trailing Stop Loss and Trailing Take Profit . to finalise my EA includes the "threshold close (0 ..100)" ,  "threshold open (0 ..100)" in points .my estimation is measuring the pips upward or downward on the linear scale of the H1 S&P500 GRAPH .should it mean that if i open a BUY at 3463.5 and close the SL at 3475 , the difference of 7 are 7 pips ? is that true ?  is S&P500 a four digit broker ? 

    i have some questions on setting the "threshold open " and "threshold close " including the swap BUY and SELL . can i continue ? 

    thanks William i value your explanations very much ,

    paul macques  

     
    Paul Walter David Macques: since my broker is asking for the SL and TP in POINTS 
    1. Your broker isn't asking for anything.
    2. SL and TP is a price not POINTS.
    3. S&P500 is a symbol (a chart) it isn't a broker.
    4. Don't resurrect eight (8) old threads without a very good reason. A lot has changed since Build 600 and Higher. 2014.02.03

    Reason: