Download MetaTrader 5
To add comments, please log in or register
Do you have idle PCs? Connect them to MQL5 Cloud Network and earn money!
zzuegg
1505
zzuegg 2011.08.25 11:59 

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
17998
Simon Gniadkowski 2011.08.25 12:25  
MarketInfo MODE_STOPLEVEL or MODE_FREEZELEVEL might give you a clue
whroeder1
14457
whroeder1 2011.08.25 15:38  
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 2011.08.25 16:00  
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 2011.08.25 16:59  
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 2011.08.26 20:46  
If someone is intrested in, i found the solution. Stops need to be rounded to MODE_TICKSIZE
Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2011.08.26 20:56  
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
14457
whroeder1 2011.08.26 21:03  
  1. what is the ticksize?
  2. Are you adjusting slippage (pips) to points (OrderSend)
zzuegg
1505
zzuegg 2011.08.26 21:29  

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 2011.08.26 21:33  

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
14457
whroeder1 2011.09.02 17:59  
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