Hello,
I'm trying to develop a tick indicator which will be used to determine if ticks are ocurring at bid, at ask or between quotes, as well as their volumes.
However, I'm having several problems when running the indicator, mainly because the indicator is returning wrong values for the volume and is wrongly identifying bid, ask and last quotes.
You don't show the code used to produce the result of your screenshot so it's difficult to give a complete answer, as I really don't understand your screenshot.
You don't show the code used to produce the result of your screenshot so it's difficult to give a complete answer, as I really don't understand your screenshot.
I provided part of the code... the idea is pretty simple, Alain:
if(LastPrice == AskPrice) { Print("AT ASK"); } else { if(LastPrice == BidPrice) { Print("AT BID"); } else { Print("BETWEEN"); } }
However, this is (somehow) not working as intended...
I provided part of the code... the idea is pretty simple, Alain:
However, this is (somehow) not working as intended...
You can't simply compare doubles like that and expect consistent results. Price can != Price, read this thread: Can price != price ?
For me "last" is always equal to the bid price. And I have still have to find out why I get more different ticks than the broker shows later a the M1 level ;)
I record ticks for 21 currencies which gives about 1 GByte for a week.
I think this could be faster:
MqlTick last_tick; //--- if(SymbolInfoTick(symbol,last_tick)) { // tickrecorder.AddTick(symbol,last_tick); }
For me "last" is always equal to the bid price. And I have still have to find out why I get more different ticks than the broker shows later a the M1 level ;)
I record ticks for 21 currencies which gives about 1 GByte for a week.
I think this could be faster:
last isn't use with forex. It's used with Depth of Market for stock exchange (maybe some broker activate DOM for forex but not sure it makes sense).
Maybe because OnCalculate() isn't the same as OnTick().
For me "last" is always equal to the bid price. And I have still have to find out why I get more different ticks than the broker shows later a the M1 level ;)
I record ticks for 21 currencies which gives about 1 GByte for a week.
I think this could be faster:
ugo58, thanks for the suggestion! However, at least for me
last_tick.last == NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_LAST),_Digits)
I believe it's not a question of how fast MqlTick( ) is, but rather OnCalculate( ) itself !
- www.mql5.com
- 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,
I'm trying to develop a tick indicator which will be used to determine if ticks are ocurring at bid, at ask or between quotes, as well as their volumes.
However, I'm having several problems when running the indicator, mainly because the indicator is returning wrong values for the volume and is wrongly identifying bid, ask and last quotes.
These problems usually occur when the market enters a "fast pace", with several orders ocurring at the same second, as shown in the picture attached. It seems to me that tick calculations cannot be made inside OnCalculate( ), because it's not fast enough to perform such computations.
Specifically in the picture attached, I'm showing the logs of two instances of MetaTrader 5 running in the same machine (i7-3930K, 4.1 MHz, 12 cores), receiving data from the same broker and running in the same symbol.
So, what could be the root of the problem? The internet connection (usually 26 ms latency, 15 Mbps), the data source itself or the OnCalculate( ) speed?
I would appreciate any explanation.
P.S.: by the way, I'm using this piece of code to capture bid/ask/last/volume information: