I'm not operating Forex, I'm under a Brazilian broker named XP Investimentos and yes, I'm using real (production) account. The symbol I'm using (WINXY) is refers to a future contract.
Thanks,
Leonardo
Hello Alain,
I'm not operating Forex, I'm under a Brazilian broker named XP Investimentos and yes, I'm using real (production) account. The symbol I'm using (WINXY) is refers to a future contract.
Thanks,
Leonardo
Are you sure your code is correct ?
Edit: I just tried with WINJ17 on Rico-Demo and it works.
Should work, though I can't check with this broker.
Are you sure your code is correct ?
Edit: I just tried with WINJ17 on Rico-Demo and it works.
Here is my code:
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
MqlTick tick;
if(SymbolInfoTick(Symbol(),tick))
{
string s;
if((tick.flags &TICK_FLAG_BID)==TICK_FLAG_BID) s+="BID|";
if((tick.flags &TICK_FLAG_ASK)==TICK_FLAG_ASK) s+="ASK|";
if((tick.flags &TICK_FLAG_LAST)==TICK_FLAG_LAST) s+="LAST|";
if((tick.flags &TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME) s+="VOL|";
if((tick.flags &TICK_FLAG_BUY)==TICK_FLAG_BUY) s+="BUY|";
if((tick.flags &TICK_FLAG_SELL)==TICK_FLAG_SELL) s+="SELL|";
Print(s);
}
return 0;
}
It's the OnCalculate function of my custom indicator. It should work, shouldn't it?
I get all flags on my string, except the BUY and SELL ones.
Thanks again,
Leonardo
Since anding with a bit mask can only result in zero or the bit mask and since non-zero is true | if((tick.flags &TICK_FLAG_BID)==TICK_FLAG_BID) s+="BID|"; if((tick.flags &TICK_FLAG_ASK)==TICK_FLAG_ASK) s+="ASK|"; if((tick.flags &TICK_FLAG_LAST)==TICK_FLAG_LAST) s+="LAST|"; if((tick.flags &TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME) s+="VOL|"; if((tick.flags &TICK_FLAG_BUY)==TICK_FLAG_BUY) s+="BUY|"; if((tick.flags &TICK_FLAG_SELL)==TICK_FLAG_SELL) s+="SELL|"; |
Code can be simplified. | if(tick.flags & TICK_FLAG_BID) s+="BID|"; if(tick.flags & TICK_FLAG_ASK) s+="ASK|"; if(tick.flags & TICK_FLAG_LAST) s+="LAST|"; if(tick.flags & TICK_FLAG_VOLUME) s+="VOL|"; if(tick.flags & TICK_FLAG_BUY) s+="BUY|"; if(tick.flags & TICK_FLAG_SELL) s+="SELL|"; |
Since anding with a bit mask can only result in zero or the bit mask and since non-zero is true | if((tick.flags &TICK_FLAG_BID)==TICK_FLAG_BID) s+="BID|"; if((tick.flags &TICK_FLAG_ASK)==TICK_FLAG_ASK) s+="ASK|"; if((tick.flags &TICK_FLAG_LAST)==TICK_FLAG_LAST) s+="LAST|"; if((tick.flags &TICK_FLAG_VOLUME)==TICK_FLAG_VOLUME) s+="VOL|"; if((tick.flags &TICK_FLAG_BUY)==TICK_FLAG_BUY) s+="BUY|"; if((tick.flags &TICK_FLAG_SELL)==TICK_FLAG_SELL) s+="SELL|"; |
Code can be simplified. | if(tick.flags & TICK_FLAG_BID) s+="BID|"; if(tick.flags & TICK_FLAG_ASK) s+="ASK|"; if(tick.flags & TICK_FLAG_LAST) s+="LAST|"; if(tick.flags & TICK_FLAG_VOLUME) s+="VOL|"; if(tick.flags & TICK_FLAG_BUY) s+="BUY|"; if(tick.flags & TICK_FLAG_SELL) s+="SELL|"; |
Leonardo
I get all flags on my string, except the BUY and SELL ones.
Thanks again,
Leonardo
Seems it's not available on your real account, but I don't know why. Ask your broker and/or write to ServiceDesk (and please keep us posted).
Yes your code is ok. I tested it and got the BUY/SELL.
Seems it's not available on your real account, but I don't know why. Ask your broker and/or write to ServiceDesk (and please keep us posted).
I wonder why this information is available at the Depth of Market window (at the transaction list) but not via CopyTicks function...
Also tried with stocks and also on the broker's MT5 demo account but no success.
Anyway, I'll contact my broker service and I'll inform you as soon as I get an answer.
Regards
Hello,
I've got an answer from my broker today.
They said they didn't have someone internally that could help me and that they had to contact a 3rd party programmer to analyse the problem. So the programmer only said that those Buy and Sell flags indeed don't work and that what programmers usually do is to compare the last price with tick's Bid and Ask. If >=Ask then it's a Buy, if <=Bid it's a Sell.
Indeed it seems to be an alternative solution, although I didn't test it yet.
But why TICK_FLAG_BUY and TICK_FLAG_SELL don't work on that broker remains a mystery of the universe...
Leonardo
Hello,
I've got an answer from my broker today.
They said they didn't have someone internally that could help me and that they had to contact a 3rd party programmer to analyse the problem. So the programmer only said that those Buy and Sell flags indeed don't work and that what programmers usually do is to compare the last price with tick's Bid and Ask. If >=Ask then it's a Buy, if <=Bid it's a Sell.
Indeed it seems to be an alternative solution, although I didn't test it yet.
But why TICK_FLAG_BUY and TICK_FLAG_SELL don't work on that broker remains a mystery of the universe...
Leonardo

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all,
I'm trying to get the TICK_FLAG_BUY and TICK_FLAG_SELL information from 'flags' in MqlTick struct provided by the CopyTicks fuction on a custom indicator but it seems I never get that information from this function.
The Symbol I'm testing it has Times & Sales enabled and this information can be seen in the transaction table in Depth of Market window, where buy transactions are in blue and sell transactions in pink. But I can't get this information with the CopyTicks function.
Am I missing something here?
Thanks for the attention.
Regards,
Leonardo