Many Brokers have 5 decimal points for the currency EURUSD and the other pairs - page 2

 
cloudbreaker:

@puncher - I would not expect TICKVALUE to differ between 4 and 5 digit brokers.

If you are using tickvalue (for example) in a formula to calculate risk-per-trade, then, although tickvalue is a constant, your relative stoploss would be part of the formula and would have to be factored by 10 as required.

I've been through all this in my EAs in the past. Adjusting an EA between 2/4 and 3/5 digit brokers is actually pretty straightforward.

This post may help you further.

https://www.mql5.com/en/forum/119868


CB


cloudbreaker - what does it mean : Adjusting an EA between 2/4 and 3/5 digit brokers is actually pretty straightforward ???

 

.

.cloudbreaker wrote >>

@puncher - I would not expect TICKVALUE to differ between 4 and 5 digit brokers.

.

It does.

.

Report for EURUSDm -- 4 digit dealer IBFX Mini


.


1.4828     MODE_LOW                Low day price. 
1.4963     MODE_HIGH               High day price. 
2009.10.19 15:49:06     MODE_TIME               The last incoming tick time (last known server time). 
1.4954     MODE_BID                Last incoming bid price. For the current symbol, it is stored in the predefined variable Bid 
1.4956     MODE_ASK                Last incoming ask price. For the current symbol, it is stored in the predefined variable Ask 
0.0001     MODE_POINT              Point size in the quote currency. For the current symbol, it is stored in the predefined variable Point 
4     MODE_DIGITS             Count of digits after decimal point in the symbol prices. For the current symbol, it is stored in the predefined variable Digits 
2     MODE_SPREAD             Spread value in points. 
3     MODE_STOPLEVEL          Stop level in points. 
10000     MODE_LOTSIZE            Lot size in the base currency.
1     MODE_TICKVALUE          Tick value in the deposit currency. 
0.0001     MODE_TICKSIZE           Tick size in the quote currency. 
0     MODE_SWAPLONG           Swap of the long position. 
-0.31     MODE_SWAPSHORT          Swap of the short position. 
0     MODE_STARTING           Market starting date (usually used for futures). 
0     MODE_EXPIRATION         Market expiration date (usually used for futures).
1     MODE_TRADEALLOWED       Trade is allowed for the symbol. 
0.01     MODE_MINLOT             Minimum permitted amount of a lot. 
0.01     MODE_LOTSTEP            Step for changing lots. 
50     MODE_MAXLOT             Maximum permitted amount of a lot. 
3     MODE_SWAPTYPE           Swap calculation method. 0 - in points; 1 - in the symbol base currency; 2 - by interest; 3 - in the margin currency.
0     MODE_PROFITCALCMODE     Profit calculation mode. 0 - Forex; 1 - CFD; 2 - Futures. 
0     MODE_MARGINCALCMODE     Margin calculation mode. 0 - Forex; 1 - CFD; 2 - Futures; 3 - CFD for indices.
10000     MODE_MARGININIT         Initial margin requirements for 1 lot. 
10000     MODE_MARGINMAINTENANCE  Margin to maintain open positions calculated for 1 lot.
5000     MODE_MARGINHEDGED       Hedged margin calculated for 1 lot. 
25     MODE_MARGINREQUIRED     Free margin required to open 1 lot for buying. 
0     MODE_FREEZELEVEL        Order freeze level in points. If the execution price lies within the range defined by the freeze level, the order cannot be modified, cancelled or closed. 
.
Report for EURUSD -- 5 digit dealer MBTrading Mini
.
1.48242     MODE_LOW                Low day price. 
1.49379     MODE_HIGH               High day price. 
2009.11.13 16:59:56     MODE_TIME               The last incoming tick time (last known server time). 
1.49016     MODE_BID                Last incoming bid price. For the current symbol, it is stored in the predefined variable Bid 
1.49036     MODE_ASK                Last incoming ask price. For the current symbol, it is stored in the predefined variable Ask 
0.00001     MODE_POINT              Point size in the quote currency. For the current symbol, it is stored in the predefined variable Point 
5     MODE_DIGITS             Count of digits after decimal point in the symbol prices. For the current symbol, it is stored in the predefined variable Digits 
20     MODE_SPREAD             Spread value in points. 
0     MODE_STOPLEVEL          Stop level in points. 
10000     MODE_LOTSIZE            Lot size in the base currency.
0.1     MODE_TICKVALUE          Tick value in the deposit currency. 
0.00001     MODE_TICKSIZE           Tick size in the quote currency. 
-1     MODE_SWAPLONG           Swap of the long position. 
-1.6     MODE_SWAPSHORT          Swap of the short position. 
0     MODE_STARTING           Market starting date (usually used for futures). 
0     MODE_EXPIRATION         Market expiration date (usually used for futures).
1     MODE_TRADEALLOWED       Trade is allowed for the symbol. 
0.1     MODE_MINLOT             Minimum permitted amount of a lot. 
0.1     MODE_LOTSTEP            Step for changing lots. 
10000     MODE_MAXLOT             Maximum permitted amount of a lot. 
2     MODE_SWAPTYPE           Swap calculation method. 0 - in points; 1 - in the symbol base currency; 2 - by interest; 3 - in the margin currency.
0     MODE_PROFITCALCMODE     Profit calculation mode. 0 - Forex; 1 - CFD; 2 - Futures. 
0     MODE_MARGINCALCMODE     Margin calculation mode. 0 - Forex; 1 - CFD; 2 - Futures; 3 - CFD for indices.
0     MODE_MARGININIT         Initial margin requirements for 1 lot. 
0     MODE_MARGINMAINTENANCE  Margin to maintain open positions calculated for 1 lot.
0     MODE_MARGINHEDGED       Hedged margin calculated for 1 lot. 
149.04     MODE_MARGINREQUIRED     Free margin required to open 1 lot for buying. 
0     MODE_FREEZELEVEL        Order freeze level in points. If the execution price lies within the range defined by the freeze level, the order cannot be modified, cancelled or closed. 
 

Ah yes Phy - you and I have been here before.

Was thinking of the ratio of TickValue / Ticksize which is what I use.

Sorry all.


CB

 
puncher:


cloudbreaker - what does it mean : Adjusting an EA between 2/4 and 3/5 digit brokers is actually pretty straightforward ???

There really isn't any complexity to it:

- Detect whether you're dealing with a 3/5 digit or a 2/4 digit broker.

- Use a factor of 10 together with all relative values (SL, TP, Slippage) if its a 3/5 digit broker - remembering places such as lot/risk calculations where you may also use the relative SL value.

- Normalize your prices to the correct number of digits prior to using them in order functions etc.

- Remember that Print() will return 4 decimal places unless you use DoubleToStr().


That really is all there is to it.


CB

 
cloudbreaker:

There really isn't any complexity to it:

- Detect whether you're dealing with a 3/5 digit or a 2/4 digit broker.

- Use a factor of 10 together with all relative values (SL, TP, Slippage) if its a 3/5 digit broker - remembering places such as lot/risk calculations where you may also use the relative SL value.

- Normalize your prices to the correct number of digits prior to using them in order functions etc.

- Remember that Print() will return 4 decimal places unless you use DoubleToStr().


That really is all there is to it.


CB


Can I use DoubleToStr() function for put TP, SL, Ask or Bid prices into the OrderSend(), OrderModify() or OrderClose() functions???

 

Use NormalizeDouble( valueToNormalize, Digits)

 
phy:

Use NormalizeDouble( valueToNormalize, Digits)

The reason for this, Puncher, is that DoubleToStr would return a string. If you look at the input parameters for the functions you refer to, you'll see that doubles are expected as input.

You would use DoubleToStr for a different purpose - eg. to get around the fact that Print() defaults to printing all doubles with 4 decimal places.


CB

 

All of you are wrong - In order to Exeprt Advisors works in 5 decimal point BROKERS you should do the following:


ADD:

extern bool FractionalPips = true;

int pip;

Then after the start of the strategy you include some code that sets the value of pip. Essentially when fractionalpips equals true, then pip equals 10, if not, pip equals 1.

if(FractionalPips==true)
{
pip=10;
}
else pip =1;


It is advised to change the following line :



OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order
#2",16384,0,Green);

With :



ticket=OrderSend(Symbol(),OP_BUY,1,Ask,0,0,0,"My order #2",16384,0,Green);
if(ticket>0)
{
OrderSelect(ticket,SELECT_BY_TICKET);
OrderModify(OrderTicket(),OrderOpenPrice(),STOPLOS S,TAKEPROFIT,0,Green);
}
else
{
Print("OrderSend failed with error #",GetLastError());
}

Take a look at the following forum post for more information:

http://forexforums.dailyfx.com/expert-advisor-discussion/50312-mt4-expert-advisors-2.html#post291994


I close this subject - my EA now WORKS !!!



Reason: