Download MetaTrader 5
To add comments, please log in or register
Download MetaTrader 5 for iPad and trade anywhere!
Dominic Gilbert
1632
Dominic Gilbert 2014.10.30 12:11 

So, I just wanted another set of eyes on this because as far as I am aware, in my risk (lot) calculation's, all I am calculating is what the pip value is in the term currency and not in my deposit currency?

 Therefore, depending on the market I trade, the Term Currency pnl will be correct, but relative to my GBP denominated account, it won't be? Am I correct in thinking this way?

   
   risk_amount = AccountBalance( )*RiskPercent/100;
         
   //What is loss for 1 lot?
   double loss_for_1_lot = pips_to_bsl / ts * tv ; // pips_to_bsl = buy stop loss
      
   //Get Lot Size calculations for all FOUR Trades                   
   double LotSize_Buy  = MathFloor( risk_amount / loss_for_1_lot/ Lot_Step) * Lot_Step, 

 Or does the "tv" (TICK_VALUE) return what the trading account currencies TICK_VALUE is? (in layman's terms, does the server return the tick value relative to what my denominated trading currency is?)

Keith Watford
Moderator
9544
Keith Watford 2014.10.30 12:27  
As far as I understand it, it SHOULD return the value in your account currency. However, I have recently found that lot sizes for trading on the DAX are being calculated incorrectly with one broker. It seems to me that TICK_VALUE is in Euros and not the account deposit currency, which is USD. I have advised the broker, but no response.
Dominic Gilbert
1632
Dominic Gilbert 2014.10.30 12:38  

Ok, but as you say, as far as you're aware TV returns the value relative to the traders account currency on FX pairs...

 Are we able to get a definitive answer on this? 

 

(also which broker was that with?) 

Carl Schreiber
6395
Carl Schreiber 2014.10.30 13:31  

" Or does the "tv" (TICK_VALUE) return what the trading account currencies TICK_VALUE is?"

1) Please use your reference or the docs!

I would use double LotVal = MarketInfo(Symbol(),MODE_TICKVALUE) / MarketInfo(symbol(), MODE_TICKSIZE);

which has to be refreshed once and a while so that a quote_difference*LotVal = Result_in_Acc.Currency.

JC
1453
JC 2014.10.30 14:24  
gooly:

1) Please use your reference or the docs!

The docs promise that MODE_TICKVALUE will be "in the deposit currency" but, as GumRai is saying, what the docs promise isn't always what actually happens when a broker implements CFDs.

There used to be lots of brokers where CFDs were reported in the instrument's base currency (e.g. EUR for the Dax), rather than in the deposit currency as promised. I can't actually think of any where that is still the case; all the brokers I am aware of now handle CFDs properly. But I do know of a broker where the MODE_TICKVALUE on the Dax is just simply wrong; it's in euros, converted to the deposit currency, but the base value in euros has been mis-entered on the MT4 Server...

JC
1453
JC 2014.10.30 14:55  
DomGilberto:

[...] to my GBP denominated account, it won't be?

... For GBP completeness, lots of UK spread betting accounts used to have incorrect MODE_TICKVALUEs. However, all the spread betting accounts which I'm aware of are now reported correctly (because the spread betting instruments are defined in MT4 as CFDs, and the CFD handling now works properly).
Carl Schreiber
6395
Carl Schreiber 2014.10.30 16:45  
jjc:

The docs promise that MODE_TICKVALUE will be "in the deposit currency" but, as GumRai is saying, what the docs promise isn't always what actually happens when a broker implements CFDs.

There used to be lots of brokers where CFDs were reported in the instrument's base currency (e.g. EUR for the Dax), rather than in the deposit currency as promised. I can't actually think of any where that is still the case; all the brokers I am aware of now handle CFDs properly. But I do know of a broker where the MODE_TICKVALUE on the Dax is just simply wrong; it's in euros, converted to the deposit currency, but the base value in euros has been mis-entered on the MT4 Server...

I think the DAX is always in EUR but TickValue should convert this EUR value to the account-value!

Therefore the Tickvalue changes always due the volatile rate between EUR and the AccountCurrency other than the Point ("Returns the point size of the current symbol in the quote currency")!!

Ok, if you do have an EUR-account you won't see any change of course!

I hardly can imagine that the broker has entered wrong TickValues as this would cause wrong prices booked into the accounts of all their client!

JC
1453
JC 2014.10.30 17:18  
gooly:

I hardly can imagine that the broker has entered wrong TickValues as this would cause wrong prices booked into the accounts of all their client!

No, that's not correct.

The way that MT4 itself calculates its profit is not affected by MODE_TICKVALUE. It's possible for the profit which MT4 reports on open positions to be correct while MODE_TICKVALUE is wrong.

As GumRai independently confirms, MODE_TICKVALUE is not always reliable. But that does not mean that the broker is booking incorrect profits for trades. It only means that EAs miscalculate things like lot sizes or s/l distances if MODE_TICKVALUE is wrong.

Keith Watford
Moderator
9544
Keith Watford 2014.10.30 22:49  
jjc:

No, that's not correct.

The way that MT4 itself calculates its profit is not affected by MODE_TICKVALUE. It's possible for the profit which MT4 reports on open positions to be correct while MODE_TICKVALUE is wrong.

As GumRai independently confirms, MODE_TICKVALUE is not always reliable. But that does not mean that the broker is booking incorrect profits for trades. It only means that EAs miscalculate things like lot sizes or s/l distances if MODE_TICKVALUE is wrong.

That is correct.

The reason that I spotted this is because my calculated lot sizes were resulting in losses of 25%+ more than they should have been when the stop loss was hit.

I have checked and I see that the profit calculation mode is "Futures", not "CFD" , but I don't see that this should be relevant.

It seems, that with this broker the FTSE tick value is also wrong and that would mean that calculated lot sizes would result in losses of 60% more if the stop loss is hit.

Another worrying aspect with this script

  Print("TS="+DoubleToStr(MarketInfo(Symbol(),MODE_TICKSIZE),Digits)+
        "  TV="+DoubleToStr(MarketInfo(Symbol(),MODE_TICKVALUE),2));

 Applied twice to the chart, I got this

0       05:14:26.484    Script a EURAUD,H1: loaded successfully
0       05:14:26.500    a EURAUD,H1: initialized
0       05:14:26.500    a EURAUD,H1: TS=0.0001  TV=0.00
0       05:14:26.500    a EURAUD,H1: uninit reason 0
0       05:14:26.500    Script a EURAUD,H1: removed
0       05:15:13.640    Script a EURAUD,H1: loaded successfully
0       05:15:13.656    a EURAUD,H1: initialized
0       05:15:13.656    a EURAUD,H1: TS=0.0001  TV=8.84
0       05:15:13.656    a EURAUD,H1: uninit reason 0
0       05:15:13.656    Script a EURAUD,H1: removed

 Subsequent applications returned the correct value, but one wrong value is one too many! It can give a zero divide error.

 

 

DomGilberto:

(also which broker was that with?) 

I haven't named the broker due to the rule against broker discussion 

Alain Verleyen
Moderator
30299
Alain Verleyen 2014.10.31 00:57  
GumRai:

That is correct.

The reason that I spotted this is because my calculated lot sizes were resulting in losses of 25%+ more than they should have been when the stop loss was hit.

I have checked and I see that the profit calculation mode is "Futures", not "CFD" , but I don't see that this should be relevant.

It seems, that with this broker the FTSE tick value is also wrong and that would mean that calculated lot sizes would result in losses of 60% more if the stop loss is hit.

Another worrying aspect with this script

 Applied twice to the chart, I got this

 Subsequent applications returned the correct value, but one wrong value is one too many! It can give a zero divide error.

...
SymbolInfoDouble() with SYMBOL_TRADE_TICK_VALUE give you the same result ? Maybe they are not implemented in the same way.
Keith Watford
Moderator
9544
Keith Watford 2014.10.31 02:14  
angevoyageur:
SymbolInfoDouble() with SYMBOL_TRADE_TICK_VALUE give you the same result ? Maybe they are not implemented in the same way.

Yes, it gives the same result

SYMBOL_TRADE_TICK_VALUE_PROFIT and SYMBOL_TRADE_TICK_VALUE_LOSS return 0.00, although I'm not sure of the point of them as surely tick value is the same for a profit or a loss? 

/ /123
To add comments, please log in or register