Tick value in MQL5

 

Hello, can anyone explain how to get a tick value MQL 5?

I use SYMBOL_TRADE_TICK_VALUE but it return 56.88 for EURUSD, this is wrong for sure

 
Roman Sharanov:

Hello, can anyone explain how to get a tick value MQL 5?

I use SYMBOL_TRADE_TICK_VALUE but it return 56.88 for EURUSD, this is wrong for sure

It depends on your account currency. It seems your account currency is RUB. In this case the Tick Value is correct. But not all Symbols must have Tick Value in the account currency. See my topic:

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

 
Petr Nosek:

It depends on your account currency. It seems your account currency is RUB. In this case the Tick Value is correct. But not all Symbols must have Tick Value in the account currency. See my topic:

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

OMG, the devil is in the details, deposit was in RUB, now I see it work, thank you!

 
Petr Nosek:

It depends on your account currency. It seems your account currency is RUB. In this case the Tick Value is correct. But not all Symbols must have Tick Value in the account currency. See my topic:

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

Damned Petr, I don't know why you keep repeating that. That's NOT exact !

All symbols must have tick value in account currency.

Some brokers provides wrong data. That's an other matter completely.

 
Alain Verleyen:

Damned Petr, I don't know why you keep repeating that. That's NOT exact !

All symbols must have tick value in account currency.

Some brokers provides wrong data. That's an other matter completely.

All symbols should (must) have tick value in the account currency (according to the documentation but documentation doesn't always tell the truth) but not all symbols at all brokers have tick value in the account currency. It means you have to check it.

 
Petr Nosek:

All symbols should (must) have tick value in the account currency (according to the documentation but documentation doesn't always tell the truth) but not all symbols at all brokers have tick value in the account currency. It means you have to check it.

Earlier, I was wondering how would you check it ? 

 
Icham Aidibe:

Earlier, I was wondering how would you check it ? 

In general: Manually so far.
At my brokers: I can rely on the value SymbolInfoInteger(_Symbol,SYMBOL_TRADE_CALC_MODE). If the value is equal to 2 ("Futures") it means that the tick value is in the base currency.

Have a look at attached files. At the same account:

for EURUSD (Profit calculation mode 0) the tick value is in the deposit currency (CZK) as documentation says

for Crude Oil (Profit calculation mode 2) the tick value is in base currency (USD)

 
Petr Nosek:

In general: Manually so far.
At my brokers: I can rely on the value SymbolInfoInteger(_Symbol,SYMBOL_TRADE_CALC_MODE). If the value is equal to 2 ("Futures") it means that the tick value is in the base currency.

Have a look at attached files. At the same account:

for EURUSD (Profit calculation mode 0) the tick value is in the deposit currency (CZK) as documentation says

for Crude Oil (Profit calculation mode 2) the tick value is in base currency (USD)

Thank you for the tips.

 

I had this same doubt and after testing and comparing with real trades I actuallt did, I found the following :


SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE)*Number of points = profit/loss on that trade.

However if you are trading a pair that does not have your currency account the variable SYMBOL_TRADE_TICK_VALUE will fluctuate.

For example, you account is in USD and you make a trade on AUDCAD and you get 100 points today. Tomorrow you manage to make the same trade and get 100 points again. Your profit you not necessarily be the same. This is because SYMBOL_TRADE_TICK_VALUE varies as well.

SYMBOL_TRADE_TICK_VALUE depends of the ratio USD/CAD or USD/AUD depending on waht is the pair SYMBOL_CURRENCY_PROFIT.

So you are actually trading 2 pairs at the same time.

 
douglas14:

I had this same doubt and after testing and comparing with real trades I actuallt did, I found the following :


SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE)*Number of points = profit/loss on that trade.

However if you are trading a pair that does not have your currency account the variable SYMBOL_TRADE_TICK_VALUE will fluctuate.

For example, you account is in USD and you make a trade on AUDCAD and you get 100 points today. Tomorrow you manage to make the same trade and get 100 points again. Your profit you not necessarily be the same. This is because SYMBOL_TRADE_TICK_VALUE varies as well.

SYMBOL_TRADE_TICK_VALUE depends of the ratio USD/CAD or USD/AUD depending on waht is the pair SYMBOL_CURRENCY_PROFIT.

So you are actually trading 2 pairs at the same time.

Just want to say THANK YOU SO MUCH FOR THIS explanation!!! Now I can finally perform the darned risk based lot size calculation. I was worried I'd have to dynamically convert currencies...to be honest I find that process confusing so I am glad I don't have to do it.

In summary, in case its of use to any other new trader like me, I have:

Lots = Account Balance * Risk as Decimal / Stop Loss Distance in Points * Dollars Per Point

The last one, dollars per point, was always the confusing one. Knowing that I can simply use SYMBOL_TRADE_TICK_VALUE and this resolves everything. And then you just make sure you normalize the lots so that they are in units of the lot step size (using SYMBOL_VOLUME_STEP), verify that they exceed minimum lot size (SYMBOL_VOLUME_MIN), and then you should have a proper risk-based lot size double value.
 
Yeah Piotr, I worked tht out a while back, and used it in MQL4 but have now tried to migrate to MQL5 and have got  
double tv = SymbolInfoDouble(sym, SYMBOL_TRADE_TICK_VALUE);
double lot = riskQ / (ticks * tv);

(riskQ either equalling a percentage or a specific amount depending on my risk management settings)

but getting a divide by zero error on that second line.

Debugging it gives this:

Debug window

How can SYMBOL_TRADE_TICK_VALUE == 0.0

?????????????????????

So frustrated