Download MetaTrader 5

On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql?

To add comments, please log in or register
zzuegg
1505
zzuegg  

Hi,

lately i trade a bit the dax. My Broker offers a 5 digit stream and so also on the dax i have 7123.x stream

My range of supporting scripts uses 4/5 digit adjustment but fails of course on the dax, because even if the stream is 5digits i am allowed only to set the stops at full pip values. 7000.0 for example. How can i locate this issue using mql4.

Of course i can use only Digit-1 in the normalization process, but then it would affect also all other symbols where i am allowed to place stops at sub pip level.

Any ideas?

//z

Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
MarketInfo MODE_STOPLEVEL or MODE_FREEZELEVEL might give you a clue
whroeder1
15321
whroeder1  
I haven't see any broker that requires stops on full pip values. Stops must be at least stoplevel*point away from market.
Ubzen
5394
Ubzen  
Perhaps because it's a Stock Index, the broker plays by a different rule. 4/5 digits as I understand it means... digits after the decimal point. 7123.x would mean one(1) digit to me. The way I would solve this problem is to ask IF dax and then round the stops to the nearest whole number (or normalize(x,1) if that's what it allows). And no... I don't know a command to show if it accepts whole number stops only :) Cheers.
zzuegg
1505
zzuegg  
WHRoeder:
I haven't see any broker that requires stops on full pip values. Stops must be at least stoplevel*point away from market.

Also for me this is new. Stoplevel Freezelevel are checkt. Additionally i cannot set the stop manually if it's not a full pip value. (The sending of the ordermodification works, but error 130 is returned.

Perhaps because it's a Stock Index, the broker plays by a different rule. 4/5 digits as I understand it means... digits after the decimal point. 7123.x would mean one(1) digit to me. The way I would solve this problem is to ask IF dax and then round the stops to the nearest whole number (or normalize(x,1) if that's what it allows). And no... I don't know a command to show if it accepts whole number stops only :) Cheers.

I should have written 0/1 digits here. But the rounding is done with the Digit command, and i am not using any pip/point's as input. The use for this script is to set the stops of all open orders to breakeven (after scaling in). It seems i have to round to the next positive full pip value in cas i am trading dax. But that would require a modification of the scrpits on each new stock i trade. (Not have tried any other yet, but who knows)

zzuegg
1505
zzuegg  
If someone is intrested in, i found the solution. Stops need to be rounded to MODE_TICKSIZE
Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
zzuegg:
If someone is intrested in, i found the solution. Stops need to be rounded to MODE_TICKSIZE
Thanks, that is good to know :-)
whroeder1
15321
whroeder1  
  1. what is the ticksize?
  2. Are you adjusting slippage (pips) to points (OrderSend)
zzuegg
1505
zzuegg  

MarketInfo(Symbol(),MODE_TICKSIZE) returns 0.5 for DE30

MarketInfo(Symbol(),MODE_DIGITS) return 1


I am not using any pips/slippage modifications, since all the script have to do is setting the stoploss of multiple orders to breakeven.

I am allowed only to place stops at values XXXX.5 or XXXX.0, modifications to all other subpip values gets rejected with error 130.

zzuegg
1505
zzuegg  

Addon:

The common 4/5 digit modification will also fail.

A possible modification would be:

if(Digits%2==0){
 //only full pips
}else{
 //subpips
}

This code will fail at Gold and Silver. Still no bulletproof solutions for pip/subpip modifications :(

whroeder1
15321
whroeder1  
zzuegg:

MarketInfo(Symbol(),MODE_TICKSIZE) returns 0.5 for DE30

MarketInfo(Symbol(),MODE_DIGITS) return 1

I am not using any pips/slippage modifications, since all the script have to do is setting the stoploss of multiple orders to breakeven.

I am allowed only to place stops at values XXXX.5 or XXXX.0, modifications to all other subpip values gets rejected with error 130.

Just as lot size must be a multiple of lot step
    double  minLot  = MarketInfo(Symbol(), MODE_MINLOT),
            lotStep = MarketInfo(Symbol(), MODE_LOTSTEP),
    lotSize = MathFloor(lotSize/lotStep)*lotStep;
    if (lotSize < minLot) ...
open price must be a multiple of tick size
    double  tickSize = MarketInfo(Symbol(), MODE_TICKSIZE);
    nowOpen = MathRound(nowOpen/tickSize)*tickSize;
12
To add comments, please log in or register