MODE_TICKVALUE -- LIES!!!! :) - page 3

 
SProgrammer писал(а) >>

I'm kind of smart, you know :) - I was running it in the tester. There can't be anything undetermined there.

I gave an example there - can you calculate by hand? I also gave you the answer from Marketinfo.

There is JavaScript calculator on many brokerage companies web sites, you can copy it and see how to calculate correctly.

 

For currency pairs where the quote currency is the same as the deposit currency

MarketInfo(Symbol(),MODE_LOTSIZE)*MarketInfo(Symbol(),MODE_TICKSIZE) 

in the extended version you will need to analyse the currency of the quote...

 

Depo currency USD, throw code on USDJPY chart, readings are the same

MarketInfo(Symbol(),MODE_LOTSIZE)*MarketInfo(Symbol(),MODE_TICKSIZE) )/MarketInfo(Symbol(),MODE_BID)
So we can trust the tickworm...
 
SProgrammer >>:

Вы ручками считать проверяли?

I only know how to do it automatically:

#property show_inputs

extern string BaseCurrency = "USD";

bool RealSymbol( string Str )
{
  return(MarketInfo( Str, MODE_BID) != 0);
}

double GetTickValue( string Symb, bool Average )
{
  string Str, ProfitCurrency, SymbolPrefix;
  double Res, PriceExchage;
  
  ProfitCurrency = StringSubstr( Symb, 3, 3);
  SymbolPrefix = StringSubstr( Symb, 6);
  
  if ( ProfitCurrency == BaseCurrency)
    Res = MarketInfo( Symb, MODE_LOTSIZE) * MarketInfo( Symb, MODE_TICKSIZE);
  else
  {
    Str = BaseCurrency + ProfitCurrency + SymbolPrefix;
    
    if ( RealSymbol( Str))
    {
      if ( Average)
        PriceExchage = (MarketInfo( Str, MODE_BID) + MarketInfo( Str, MODE_ASK)) / 2;
      else
//        PriceExchage = MarketInfo(Str, MODE_BID); // Так считает MetaTrader4 - неправильно
        PriceExchage = MarketInfo( Str, MODE_ASK); // Правильный вариант
        
      Res = MarketInfo( Symb, MODE_LOTSIZE) * MarketInfo( Symb, MODE_TICKSIZE) / PriceExchage;
    }
    else
    {
      Str = ProfitCurrency + BaseCurrency + SymbolPrefix;

      if ( Average)
        PriceExchage = (MarketInfo( Str, MODE_BID) + MarketInfo( Str, MODE_ASK)) / 2;
      else
        PriceExchage = MarketInfo( Str, MODE_BID);
        
      Res = MarketInfo( Symb, MODE_LOTSIZE) * MarketInfo( Symb, MODE_TICKSIZE) * PriceExchage;
    }
  }
  
  return( Res);
}

void start()
{  
  double TickValue, TickValue1, TickValue2;
  
  TickValue = MarketInfo(Symbol(), MODE_TICKVALUE);
  TickValue1 = GetTickValue(Symbol(), TRUE);
  TickValue2 = GetTickValue(Symbol(), FALSE);
  
  Print("MT4 TickValue = " + DoubleToStr( TickValue, 5));
  Print("Average TickValue = " + DoubleToStr( TickValue1, 5));
  Print("Real TickValue = " + DoubleToStr( TickValue2, 5));
  
  return;
}

You were right, MODE_TICKVALUE does not count correctly in some cases: everything only counts via the BID price, even when it should count via the ASK price.

 
getch >>:

Умею только автоматом:

Вы оказались правы, MODE_TICKVALUE считается в некоторых случаях некорректно: все считается только через BID-цену, даже когда надо считать через ASK-цену.

How much of a margin of error is that?

 
kombat >>:

А насколь % эта погрешность?

Enough to make the auditors have questions.

 
getch >>:

Достаточная, чтобы у аудиторов возникли вопросы.

On the tic volum???

I thought they were only interested in opening price closing price...?

 
kombat >>:

Нуно не одна из, а та что валюта котировки, JPY в данном случае.

Watch -


USDJPY


tester on period


2008/10/01 -> 2009/01/01


Skip to 2008/10/01


====


2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_FREEZELEVEL=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_MARGINREQUIRED=1000.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_MARGINHEDGED=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_MARGINMAINTENANCE=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_MARGININIT=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_MARGINCALCMODE=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_PROFITCALCMODE=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_SWAPTYPE=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_MAXLOT=1000.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_LOTSTEP=0.10000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_MINLOT=0.10000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_TRADEALLOWED=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_EXPIRATION=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_STARTING=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_SWAPSHORT=-0.50000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_SWAPLONG=-0.50000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_TICKSIZE=0.00100000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_TICKVALUE=1.09488252

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_LOTSIZE=100000.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_STOPLEVEL=20.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_SPREAD=19.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_DIGITS=3.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_POINT=0.00100000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_ASK=111.70900000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_BID=111.69000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_TIME=1199260860.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_HIGH=0.00000000

2010.01.13 12:14:42 2008.01.02 08:01 OTestExpert3 USDJPY,M1: MODE_LOW=0.00000000


=============


string s=Symbol();
   
   int Code2[]={  MODE_LOW,
                  MODE_HIGH,
                  MODE_TIME,
                  MODE_BID,
                  MODE_ASK,
                  MODE_POINT,
                  MODE_DIGITS,
                  MODE_SPREAD,
                  MODE_STOPLEVEL,
                  MODE_LOTSIZE,
                  MODE_TICKVALUE,
                  MODE_TICKSIZE,
                  MODE_SWAPLONG,
                  MODE_SWAPSHORT,
                  MODE_STARTING,
                  MODE_EXPIRATION,
                  MODE_TRADEALLOWED,
                  MODE_MINLOT,
                  MODE_LOTSTEP,
                  MODE_MAXLOT,
                  MODE_SWAPTYPE,
                  MODE_PROFITCALCMODE,
                  MODE_MARGINCALCMODE,
                  MODE_MARGININIT,
                  MODE_MARGINMAINTENANCE,
                  MODE_MARGINHEDGED,
                  MODE_MARGINREQUIRED,
                  MODE_FREEZELEVEL
               };
   string CodeName2[]={"MODE_LOW",
                        "MODE_HIGH",
                        "MODE_TIME",
                        "MODE_BID",
                        "MODE_ASK",
                        "MODE_POINT",
                        "MODE_DIGITS",
                        "MODE_SPREAD",
                        "MODE_STOPLEVEL",
                        "MODE_LOTSIZE",
                        "MODE_TICKVALUE",
                        "MODE_TICKSIZE",
                        "MODE_SWAPLONG",
                        "MODE_SWAPSHORT",
                        "MODE_STARTING",
                        "MODE_EXPIRATION",
                        "MODE_TRADEALLOWED",
                        "MODE_MINLOT",
                        "MODE_LOTSTEP",
                        "MODE_MAXLOT",
                        "MODE_SWAPTYPE",
                        "MODE_PROFITCALCMODE",
                        "MODE_MARGINCALCMODE",
                        "MODE_MARGININIT",
                        "MODE_MARGINMAINTENANCE",
                        "MODE_MARGINHEDGED",
                        "MODE_MARGINREQUIRED",
                        "MODE_FREEZELEVEL"
                        };
   
   for ( i=0; i< ArraySize( Code2); i++){
      
      double mre  = MarketInfo ( s, Code2[ i]);
      int    err = GetLastError();
         
      Print ( CodeName2[ i],"=", DoubleToStr( mre,9));
 
      
      if ( ERR_NO_ERROR != err )
          Print ( "error(", err,")", "--", ErrorDescription( err)  );
 
SProgrammer >>:

MODE_TICKVALUE для EURUSD по маркетинфо = 1.0000000 :), а не 10.


1 - for 5 digits

10 - for 4

 
kombat >>:

По тик волуму???

Мне казалось что их интересует лишь цена окрытия цена закрытия...

I don't know how the developers calculate the profit. If they do it via MODE_TICKVALUE, then profit in some cases is counted incorrectly - more than it actually is. For example, on GBPJPY.

But in fact MetaTrader4 calculates profits incorrectly at all - it converts profit currency to the account base currency immediately. The correct way to do it is at the time of value.

On the interbank, Equity is constantly changing if you have opened and closed a position with a profit currency that is not equal to the account currency (for example, on a USD account you made a USDJPY trade). It is only at the moment of valuation (I may be using the term incorrectly) that Equity is fixed (using the example - profit in JPY is translated at the current USDJPY to USD exchange rate).

The most interesting thing is how profit is counted, e.g. for AUDNZD on EUR account, when EURNZD rate is not available from broker...

Reason: