EA trading pips not points - any advice?

 

Hello,

I realise that most people want their EAs to trade in pips rather than points (0.1 pips and the fifth digit on a 5-digit broker) but I am looking for the numerical inputs I put into my EA to be interpreted as points i.e. if I put 10 in for a Stop Loss and a Take Profit then it will actually mean 10 points or 1 pip, not 10 pips or 100 points as is common etc.

I have examined my coding and have identified where the conversion for 4/5 digit brokers is but can't see what I actually need to change.

Any advice is most welcome.

Thank you!

double PFactor(string pair)
{
   
   double PipFactor=10000; 

   if (StringFind(pair,"JPY",0) != -1 || StringFind(pair,"XAG",0) != -1)
   PipFactor = 100; // if jpy or silver

   if (StringFind(pair,"XAU",0) != -1)
   PipFactor = 10; // if gold

   return (PipFactor);
}//End double PFactor(string pair)
 
consortium:

Hello,

I realise that most people want their EAs to trade in pips rather than points (0.1 pips and the fifth digit on a 5-digit broker) but I am looking for the numerical inputs I put into my EA to be interpreted as points i.e. if I put 10 in for a Stop Loss and a Take Profit then it will actually mean 10 points or 1 pip, not 10 pips or 100 points as is common etc.

I have examined my coding and have identified where the conversion for 4/5 digit brokers is but can't see what I actually need to change.


Nobody should know your code better than you . . .  unless of course it is not actually your code.
 
RaptorUK:

Nobody should know your code better than you . . .  unless of course it is not actually your code.


Thank you RaptorUK for your less than helpful answer.

My EA is based on a free and open source shell EA code which was written to help other people (i.e. me) form the basis of an EA upon which one would then add to according to one's needs (i.e. trading logic).  I have tried contacting the author to no avail and was hoping for some advice from this forum.

As a long-time lurker on this forum and having got to know some of the members here through their posts, I am surprised at the scathing nature of RaptorUK's comment.  I suppose he lives up to his name.

If anyone else would like to offer something other than a put-down I would be most grateful. 

 
consortium:

As a long-time lurker on this forum and having got to know some of the members here through their posts, I am surprised at the scathing nature of RaptorUK's comment.  I suppose he lives up to his name.

If anyone else would like to offer something other than a put-down I would be most grateful. 

If you want to read a "put-down" into my reply then that is your prerogative,  and if you don't want my help that is your prerogative also.

In my opinion 3 possible values of   Pipfactor of 10, 100 and then 10,000 don't make much sense to me . . .  perhaps you should show the context of how  PFactor() is used . . .  

 
//++++ 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(){                                             OptInitialization();
     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());
     */
 
WHRoeder:


Thanks for this, but what do I do with it?  Does it replace the code I have originally or does it get inserted into the code as an addition?

Thank you again. 

 
Try to search the forum first before asking a question (https://www.mql5.com/en/search). Click "Forum" on left side page and type "4/5 Digit broker" without double quotes, and click search, and you'll find this : https://www.mql4.com/search#!keyword=4%2F5%20digits&module=mql4_module_forum
Reason: