Errors, bugs, questions - page 1786
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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 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.
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.
Measured ten minutes on Si.
Third, even if SymbolInfoTick() is OK - it still works better than CopyTicks(), because it often returns more up-to-date values.
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.
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
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.
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
Then it would be logical to supplement
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 even makes sense to add a tick number to the current queue.