wrong value for SYMBOL_TRADE_TICK_VALUE

 

Hi to alla guys ,

Wile i was trying to set my EA code for a strategy in AUXUSD I get  a strange value for SYMBOL_TRADE_TICK_VALUE, spcifically this is my code snippet :

int OnInit()
  {
	string szSymbol = "XAUUSD";
	bool selected = SymbolSelect(szSymbol, true );  // select in market Watch
	bool found = ChartSetSymbolPeriod( ID , szSymbol, PERIOD_M5 ); // change in chart 
	...
	
  }
void OnTick()
{
	if( !isNewBar() ) 
        return;
        

   string symbol = ChartSymbol(ID);  // equivalent to Symbol();
   double TickValue = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE);        
        // "Tick value in the deposit currency"  <- for a AUXUSD price of 1977.34 I get 0.100000000000000006 bu i expected 0.00050572991
        // Am i wrong ???
        double TickSize  = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE);
        double pipValue = TickValue /TickSize;
	...

my deposit currency is in EUR , i checked with Print("Deposit currency = ",AccountInfoString(ACCOUNT_CURRENCY)); 

2023.03.31 12:03:01.530 XAUUSD_GPT4 Deposit currency = EUR

could some one give me some light  where isthe mistake ?

thanks


 
pipValue = pipDistance * TickValue / TickeSize.
 
Hi William ,

I know  this line is not correct, and i'll change it. 
but my problem is above  in line 
double TickValue = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE); 

what's wrong ?... Why i get the value i posted. ? it's my fault ?

 
jossnet #:
Hi William ,

I know  this line is not correct, and i'll change it. 
but my problem is above  in line 

what's wrong ?... Why i get the value i posted. ? it's my fault ?

This value is set by the broker on the server side. It's not rare it's wrong. The solution is to calculate it yourself or...

Ask your broker to fix it.

 
jossnet #: I know  this line is not correct, and i'll change it. but my problem is above  in line what's wrong ?... Why i get the value i posted. ? it's my fault ?

Try the following Script (not EA) and show us the results of the Experts log ...

#property script_show_inputs

input string sSymbol = "XAUUSD";

void OnStart() {
   string sAccountCurrency = AccountInfoString( ACCOUNT_CURRENCY );
   double dbTickValue      = SymbolInfoDouble( sSymbol, SYMBOL_TRADE_TICK_VALUE );
   PrintFormat( "Tick value of %s is %.8f %s", sSymbol, dbTickValue, sAccountCurrency );
};

I get the following ...

2023.03.31 12:47:03.647 TestCalc (EURUSD,H1)    Tick value of XAUUSD is 0.91974321 EUR
 
jossnet:

Wile i was trying to set my EA code for a strategy in AUXUSD I get  a strange value for SYMBOL_TRADE_TICK_VALUE, spcifically this is my code snippet :

It looks as though (a) you are misunderstanding the meaning of the tick value, but (b) the figure being reported is nevertheless wrong.

It is meant to be the same as the old MODE_TICKVALUE: the value, in your deposit currency, of a change in price by the tick size when trading 1 lot. For example, when trading 1 lot (100,000) of EUR/USD, with a tick size of 0.00001, then each change by the tick size is worth $10, and SYMBOL_TRADE_TICK_VALUE will be $10 converted from USD to your deposit currency. The current price is immaterial. The value is not something like 1 / 1977.34.

But the value of 0.10 which you are reporting is nevertheless incorrect. That is clearly in USD, whereas it should be converted to your EUR deposit currency. I don't think that I have ever seen this on MT5, but it is quite common on MT4 when brokers configure their non-fx markets in a way which works for profit calculations but breaks the data reported to EAs via MODE_TICKVALUE / SYMBOL_TRADE_TICK_VALUE. Your only option, if your broker has done this, is to do your own calculation. 

 

Hi alain ,

ok , so it's for sure not my fault.
That said. Ho can I calculate on my own ?  is there a command like "GETCURRENT_TICK_PRICE" or something like?  so that i can calculate like 1/  "GETCURRENT_TICK_PRICE" 

or you have  any other suggestion ? 

 
j_____c #: It looks as though (a) you are misunderstanding the meaning of the tick value, but (b) the figure being reported is nevertheless wrong. It is meant to be the same as the old MODE_TICKVALUE: the value, in your deposit currency, of a change in price by the tick size when trading 1 lot. For example, when trading 1 lot (100,000) of EUR/USD, with a tick size of 0.00001, then each change by the tick size is worth $10, and SYMBOL_TRADE_TICK_VALUE will be $10 converted from USD to your deposit currency. The current price is immaterial. The value is not something like 1 / 1977.34. But the value of 0.10 which you are reporting is nevertheless incorrect. That is clearly in USD, whereas it should be converted to your EUR deposit currency. I don't think that I have ever seen this on MT5, but it is quite common on MT4 when brokers configure their non-fx markets in a way which works for profit calculations but breaks the data reported to EAs via MODE_TICKVALUE / SYMBOL_TRADE_TICK_VALUE. Your only option, if your broker has done this, is to do your own calculation. 
MODE_TICKVALUE is for MQL4. This question is posted in MQL5 section. Please don't mix up the two.
 
jossnet #: ok , so it's for sure not my fault. That said. Ho can I calculate on my own ?  is there a command like "GETCURRENT_TICK_PRICE" or something like?  so that i can calculate like 1/  "GETCURRENT_TICK_PRICE" 

or you have  any other suggestion ? 

That has not been confirmed yet. Please run my example Script and report the results so we can confirm the situation.

 
j_____c #:

It looks as though (a) you are misunderstanding the meaning of the tick value, but (b) the figure being reported is nevertheless wrong.

It is meant to be the same as the old MODE_TICKVALUE: the value, in your deposit currency, of a change in price by the tick size when trading 1 lot. For example, when trading 1 lot (100,000) of EUR/USD, with a tick size of 0.00001, then each change by the tick size is worth $10, and SYMBOL_TRADE_TICK_VALUE will be $10 converted from USD to your deposit currency. The current price is immaterial. The value is not something like 1 / 1977.34.

But the value of 0.10 which you are reporting is nevertheless incorrect. That is clearly in USD, whereas it should be converted to your EUR deposit currency. I don't think that I have ever seen this on MT5, but it is quite common on MT4 when brokers configure their non-fx markets in a way which works for profit calculations but breaks the data reported to EAs via MODE_TICKVALUE / SYMBOL_TRADE_TICK_VALUE. Your only option, if your broker has done this, is to do your own calculation. 

Wrong, it's 1$.

 

Hi fernando ,

I run the script and this is the result :

2023.03.31 13:58:04.000	TestTickValue (@CLE,H1)	Tick value of XAUUSD is 0.10000000 EUR