Custom Symbol - Tick time shows yeah 1970 New comment mavios.s7 2018.02.03 03:28 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 CopyTicks question Testing 'CopyTicks' expert advisor - miscellaneous questions Eleni Anna Branou 2018.02.03 09:47 #1 Use the </> code button to insert your code. New comment
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