Errors, bugs, questions - page 1786

 
fxsaber:
If OnCalculate is replaced by OnTick, no errors occur. The problem is not SymbolInfoTick, but that the indicators are not properly set for no skips.
How long were you doing measurements? And what does indicator tuning have to do with it? Arrival time of the current tick is 10, arrival time of the previous tick is 11. There is an error in the function that does not return the current value. You agree that the current time value cannot be smaller than the previous one, don't you?
 
Alexey Kozitsyn:
How long did the measurements take? And what does this have to do with setting the indicators? Arrival time of the current tick is 10, arrival time of the previous tick is 11. This is an error of the function that does not return the current value. You agree that the current time value cannot be smaller than the previous one, don't you?

SymbolInfoTick works differently in indicators than it does in EAs.

In an indicator, it always returns the tick that was the initiator of the call of OnCalculate. And these initiator ticks in the indicator should not be skipped - this is the ideology of the developers. The problem is in the forming of the queue of these ticks.

In the EA, SymbolInfoTick in OnTick does not return the tick that initiated the call of OnTick, but makes a complete request for the current state.

Measured ten minutes on Si.

 
fxsaber:

SymbolInfoTick works differently in indicators than it does in EAs.

In an indicator, it always returns the tick that was the initiator of the call of OnCalculate. And these initiator ticks in the indicator should not be skipped - this is the ideology of the developers. The problem is in the forming of the queue of these ticks.

In the Expert Advisor, SymbolInfoTick in OnTick does not return the tick that initiated the call of OnTick, but makes a complete request for the current state.

So, the tick queue is slanted. In any case we need to sort out the work in indicators. It seems that the main emphasis is placed on testing of functions for working with Expert Advisors. This is the first one. Second, are you sure that SymbolInfoTick() is a synchronous function? Third, even if SymbolInfoTick() is OK - it still works better than CopyTicks(), because it often returns more actual values. Anyway, as I said before there are a lot of errors with ticks. And developers are silent...
 
fxsaber:

Measured ten minutes on Si.

That's very little. Measure for several hours. On several instruments.
 
Alexey Kozitsyn:
Third, even if SymbolInfoTick() is OK - it still works better than CopyTicks(), because it often returns more up-to-date values.
I've caught situations when CopyTicks returned more recent data than SymbolInfoTick called LATER. That's why I make query by two functions at once and select the most recent tick from them.
 
fxsaber:
Caught situations when CopyTicks gives more recent data than SymbolInfoTick called LATER. That's why I make query with two functions at once and select the most recent tick from them.
Did my test by calling SymbolInfoTick() first and only then called CopyTicks(). Anyway, do you think this behavior is correct and I don't need to change anything?
 
fxsaber:

SymbolInfoTick works differently in indicators than it does in EAs.

In an indicator, it always returns the tick that was the initiator of the call of OnCalculate. And these initiator ticks in the indicator should not be skipped - this is the ideology of the developers. The problem is in the forming of the queue of these ticks.

In the Expert Advisor, the SymbolInfoTick in OnTick does not return the tick that initiated the call of OnTick, but makes a complete request for the current state.

Then it would be logical to complement it with the

OnCalculate( ..., const MqlTick& tick );

with the tick that caused it, especially since it doesn't cost anything.

And the SymbolInfoTick() function should be fully implemented in Indicator and Expert Advisor (it will return the current prices, not the prices at the moment of call ofOnCalculate)

 

MT4 continues to amaze with unpredictability )) Who writes the implementation of the trading functions? MT4 build 1045

Let's start with the humorous info, it should be sent to Zadornov, because he is always going on about stupid Americans.

SYMBOL_TRADE_TICK_VALUE

Value SYMBOL_TRADE_TICK_VALUE_PROFIT

double

SYMBOL_TRADE_TICK_VALUE_PROFIT

Not supported

double

SYMBOL_TRADE_TICK_VALUE_LOSS

Not supported

double


Meanwhile SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE, tickValue) produces a value. BUT!!!!! If you throw the indicator on the chart, it's OK at startup. And if you restart the terminal, this function will return true and zero tickValue at first call! So don't relax, Mr. Expert Advisor developers, everything has to be checked with your own hands.

//переводит котировку в цену/1_лот в валюте депозита, например 0.00015 для EURUSD будет равно $15/лот
bool Quote2Price(double diff,double &price4lot,string symbol="EURUSD")
  {
   int dig=(int)MarketInfo(symbol,MODE_DIGITS);
   if(dig == 0)
      return(false); // symbol is none
   double tickSize = MarketInfo(symbol, MODE_TICKSIZE);   // пункт в валюте котировки (0,00001 для EURUSD на 5-знаке)
   //double tickValue = MarketInfo(symbol, MODE_TICKVALUE); // пункт в валюте депозита ($1 для EURUSD на 5-знаке)
   double tickValue;
   if(!SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE, tickValue)) // пункт в валюте депозита ($1 для EURUSD на 5-знаке)
      Print(__FUNCTION__, "  SymbolInfoDouble(...) returns false"); // всегда возвращается true!!
   Print("tickSize= ", tickSize, "  tickValue= ", tickValue);
   if(tickValue == 0.0) // исключений нет, терминал врет, надо тупо везде проверять на деление на ноль...
      return false;
   double price=diff/(tickSize/tickValue); // а то завалимся c  tickValue == 0
   price4lot=NormalizeDouble(price,2);
   return (true);
  }

Exit:

2017.02.07 16:08:25.332 ShowImportantParams EURUSD.e,M15: tickSize= 1e-05 tickValue= 1.0

2017.02.07 16:08:25.332 ShowImportantParams EURUSD.e,M15: tickSize= 1e-05 tickValue= 1.0

2017.02.07 16:08:24.515 ShowImportantParams EURUSD.e,M15: tickSize= 1e-05 tickValue= 0.0

2017.02.07 16:08:23.037 ShowImportantParams EURUSD.e,M15: tickSize= 1e-05 tickValue= 0.0

2017.02.07 16:08:23.037 ShowImportantParams EURUSD.e,M15: initialized

2017.02.07 16:08:23.002 Custom indicator ShowImportantParams EURUSD.e,M15: loaded successfully


 
A100:

Then it would be logical to supplement

OnCalculate( ..., const MqlTick& tick );

with the tick that has called it, especially since it does not cost anything

And the SymbolInfoTick() function should be fully functional in Indicator and Expert Advisor (return current prices, not prices at the moment ofOnCalculate call)

It would even be logical to add the number of tick in the current queue.
 
fxsaber:
It even makes sense to add a tick number to the current queue.
Why do you need a tick number? You just need a correct flow, which is correctly given and which can be received correctly.