allpin wrote:Hello Anton,
you can use the program
http://www.fxcodebase.com/code/viewtopi ... =27&t=4685 for your purpose.
If you need only get last candle, please use
<NumBars>1</NumBars>
in configuration file.
This program will get the last candle and continue to update it based on coming ticks.
Hi allpin,
thank you very much for the example.
I am using similar approach and honestly I am not really happy about it.
Please correct me if I am missing something, but both your example and my Client rely on the local system timer. Another words, the assumption is made that both the Client and the Sever timers are in sync, and the timer on the Client starts the minute exactly the same moment in time that the timer on the server side did.
If this is the case, then yes this approach would work just fine and the candle that is formed on the Client side would match exactly the candle that is formed on the Server side.
However, this is not the case.
As a result, even the 1 min candle that was formed by the client is different than the one that is formed on the Server by querying the history table. And based on my experience I can see that the more volatility is on the market then the greater this difference is.
From my side, I can suggest several ways of solving the issue withe the accuracy of the very last completed candle.
1. As I suggested early in this thread, caching the very last completed candle on the server side. in this case the Client can always get the very last completed 1 min candle, for example.
2. Constantly synchronizing the timers between the Server and the Client side to make sure that they both start a minute at the same moment. I have made a request to FxConnect development team to provide the functionality that would let the Client to synchronize itself with the server periodically.
3. Define and implement some kind of O2G2Session.TheMinuteEnd() event that would signal to the Client that the minute(and the very last completed candle) is closed on the Server and the Client can form the candle from the data it received through the Price Update.
But all those solutions require the help from FxConnect development team.
Thank you,
Anton.