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
After testing the indicator on live markets (BTCUSD), I noticed some strange behaviours, and had to fix quite some issues. - Currently I dont know if this is working properly, as resutls I am getting are weird, to say the least. - But for sure, OnCalculate is called much more often than tick_volume is counted up, and CopyTicksRange is somewhat unreliable for copying current tick data. At least I thought. So I switched to CopyTicks and used that, now things get interesting.
OnCalculate seems to be called for every price change, and it seems not all ticks are reflected in CopyTicks result array. But I would guess, best is to see the results for yourself, and try to understand... - I am not even able to express exactly what is going on.
Yes, even for your first posted code, I noticed that it was being called more times than the number reported in the tick volume.
I reserved my commenting on it at the time, because at the moment I am only able to test on cryptos.
Once the markets open and we are able to further test on other more active symbols will we be able to know what is going on.
Irrespective of the strange and unexpected behaviour, the better solution is still to process the tick data directly, as I described in my previous post #10.
The code I supplied, properly handles sequencing the ticks, even when the millisecond-timestamp are the same (which happens when the ticks come in faster than with millisecond resolution).
Irrespective of the strange and unexpected behaviour, the better solution is still to collect and process the tick data directly, as I described in my previous post #10.
The code I supplied, properly handles sequencing the ticks, even when the millisecond-timestamp are the same (which happens when the ticks come in faster than with millisecond resolution).
Yes, even for your first posted code, I noticed that it was being called more times than the number reported in the tick volume.
I reserved my commenting on it at the time, because at the moment I am only able to test on cryptos.
Once the markets open and we are able to further test on other more active symbols will we be able to know what is going on.
Tick volume is only considering "bid ticks" (for chart based on bid price), while OnCalculate() is called for any tick (bid, ask...).
About the main point of the topic, of course OnCalculate() can miss ticks. It has always been and it will always be.
That is what I have always thought before and what tests I carried a long time ago also proved, but I am now reconsidering it under the recent tests carried out.
Even if my recent tests were on only cryptos, the code which was purposefully delayed, still had the events being queued and not skipped.
So, currently I am not so sure about it, and I will reserve my judgment until later.
About the main point of the topic, of course OnCalculate() can miss ticks. It has always been and it will always be.
In 2021, as I programmed a very heavy indicator, I noticed the chart thread stalls, but as soon as the indicator was ready and up to date, the calculation loop was somewhat around 10ms, all ticks got processed. - Well, I am not sure if actually ALL ticks got processed, but for sure more than tick volume was. Meaning, OnCalculate was called more often than tick volume would let me suspect.
Additionally, as soon as the indicator was ready, the chart began to draw all missed candles, and I could watch the (queued up) ticks being sent to the chart one by one. - SO I was able to watch within a few seconds all the ticks and candles being drawn on chart.
Please try my testing indicator and see for yourself. - You will notice it gets much more often called than OnTick() does, and this is the case since (at least) May 2021.
Irrespective of the strange and unexpected behaviour, the better solution is still to process the tick data directly, as I described in my previous post #10.
The code I supplied, properly handles sequencing the ticks, even when the millisecond-timestamp are the same (which happens when the ticks come in faster than with millisecond resolution).
This is an interesting point, which i have handled in my own ticks processing solution.
In 2021, as I programmed a very heavy indicator, I noticed the chart thread stalls, but as soon as the indicator was ready and up to date, the calculation loop was somewhat around 10ms, all ticks got processed. - Well, I am not sure if actually ALL ticks got processed, but for sure more than tick volume was. Meaning, OnCalculate was called more often than tick volume would let me suspect.
Additionally, as soon as the indicator was ready, the chart began to draw all missed candles, and I could watch the (queued up) ticks being sent to the chart one by one. - SO I was able to watch within a few seconds all the ticks and candles being drawn on chart.
Please try my testing indicator and see for yourself. - You will notice it gets much more often called than OnTick() does, and this is the case since (at least) May 2021.
Yes, I am beginning to see that this may indeed be the case, and it also explains why the indicators stall/freeze so much during high impact news.
In 2021, as I programmed a very heavy indicator, I noticed the chart thread stalls, but as soon as the indicator was ready and up to date, the calculation loop was somewhat around 10ms, all ticks got processed. - Well, I am not sure if actually ALL ticks got processed, but for sure more than tick volume was. Meaning, OnCalculate was called more often than tick volume would let me suspect.
Additionally, as soon as the indicator was ready, the chart began to draw all missed candles, and I could watch the (queued up) ticks being sent to the chart one by one. - SO I was able to watch within a few seconds all the ticks and candles being drawn on chart.
Please try my testing indicator and see for yourself. - You will notice it gets much more often called than OnTick() does, and this is the case since (at least) May 2021.
You are right.
Forum on trading, automated trading systems and testing trading strategies
OnCalculate and OnTick function
Renat Fatkhullin , 2013.10.26 23:37
One of the reasons is the simultaneous arrival of a pack of quotes. This happens with some brokers and feeds.
In this case, the indicator works every tick , and the expert is called once on the last tick. If you call the expert using previous quotes in turn, then the expert will clearly try to trade at outdated prices and will receive a direct discrepancy with the market environment, even within its own terminal.
You are right.