need coding help please - page 4

 

you say ......."Your Slippage isn't adjusted for 4/5 Digit Broker"

I say ......my understanding is that it is in points or pips or whatever - already

i.e so 3 is good to use and 3*mypoint is incorrect.

Can anyone confirm this?


RaptorUK:

OK, a little help . . .

Find this part in your code, and change it to this . . .

This doesn't check the Magic Number . . you will need to add that in if you want to place manual orders on the same pairs or if you want to run on different timeframes on the same pair at the same time . . . do you ?

Bars is not reliable, it's a bad idea to use Bars . . you should use Time instead.

Your Slippage isn't adjusted for 4/5 Digit Brokers . . nor is your TP or SL.

If you make your SL small you will get error 130 because you aren't checking if it's too close or allowing for Spread.

Is your Broker an ECN Broker ? you can't set SL & or TP when you place an Market order with an ECN Broker, you have to code a OredrModify() to add the SL & or TP after the order is placed . . .

Shall I go on ? this is BASIC stuff . . . these points come up on this Forum day in, day out . . .

And you don't understand much of this because you haven't actually coded anything . . . you have used someone else's code . . "Expert Advisor Builder". There is only one short cut: Jobs

 
mrmedia:

you say ......."Your Slippage isn't adjusted for 4/5 Digit Broker"

I say ......my understanding is that it is in points or pips or whatever - already

i.e so 3 is good to use and 3*mypoint is incorrect.

Can anyone confirm this?




Read this https://www.mql5.com/en/forum/138912
 
mrmedia:

you say ......."Your Slippage isn't adjusted for 4/5 Digit Broker"

I say ......my understanding is that it is in points or pips or whatever - already

Slippage = 3 means 0.3 pips on a 5 digit Broker and 3 pips on a 4 Digit Broker.
 
RaptorUK:
Slippage = 3 means 0.3 pips on a 5 digit Broker and 3 pips on a 4 Digit Broker.

Once again clear as mud.

err 0.98330

slippage = 3 = where is the fill ?

slippage = 3*SymPoints (5 digit broker) = where is the fill?

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

if( SymPoints == 0.001 ) { SymPoints = 0.01; SymDigits = 3; }

else if( SymPoints == 0.00001 ) { SymPoints = 0.0001; SymDigits = 5;

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

 
mrmedia:

Once again clear as mud.

err 0.98330

slippage = 3 = where is the fill ?

slippage = 3*SymPoints (5 digit broker) = where is the fill?

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

if( SymPoints == 0.001 ) { SymPoints = 0.01; SymDigits = 3; }

else if( SymPoints == 0.00001 ) { SymPoints = 0.0001; SymDigits = 5;

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Look at the documentation for OrderSend, what type is Slippage ? how can slippage = 3*SymPoints make sense ?
 
The slippage allowed on the price is always the slippage (int) that you specify multiplied by the internal variable Point. The value of Point changes between 4 and 5 digit brokers.
 
i dont know
 
weinux:
i dont know
Thanks, that was a big help.
 
You can not use symPoints for slippage int(3 * symPoints) == 0 no slippage.
//++++ 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());
     */
Reason: