![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hi,
I am trying to add a custom symbol, where I get data from REST API and feed them into the symbol. All is going ok except tick timestamp.
look at the following code(bt is MqlTick that contains data from the REST API server):
tick[0].time=(datetime)bt.timestamp;
tick[0].time_msc=bt.timestamp*1000;
tick[0].bid=bt.bid;
tick[0].ask=bt.ask;
tick[0].last=bt.last_price;
tick[0].volume=(long)bt.volume;
tick[0].flags=0;
if(ptick.bid!=tick[0].bid) tick[0].flags|=TICK_FLAG_BID;
if(ptick.ask!=tick[0].ask) tick[0].flags|=TICK_FLAG_ASK;
if(ptick.volume!=tick[0].volume) tick[0].flags|=TICK_FLAG_VOLUME;
if(ptick.last!=tick[0].last) tick[0].flags|=TICK_FLAG_LAST;
if(tick[0].flags>0)
{
CustomTicksAdd(mtPair,tick);
MqlTick A;
SymbolInfoTick(Pair,A);
datetime TT = TimeCurrent();
datetime ss = SYMBOL_TIME;
ChartRedraw();
}
When I place a break at the last line, I get the following values:
How can I get the ticks to display correct time?
Does it have to do with REST server time being more recent than demo server time?
and how can I fix this issue?
Thanks in advance