Last Completed Candle ?

Moderator: Moderator

Re: Last Completed Candle ?

Postby sunshine » Wed Aug 24, 2011 5:27 am

Hi Anton!

Thanks for your response.

frAnton wrote:Yes, I am interested in the very last completed 1 min candle.
I want my Client to be able to get the very last completed candle every minute. Currently I am forming it myself based on the received price. But there is no indication for me when the actual minute is closed, that's why I have to rely on the local timer being in sync with the server.

1) You can use the time of the tick to define whether the actual minute should be closed. Once you get the tick which doesn't belong the actual minute, close the minute and open a new one.
This way is used in Marketscope.
2) You can use O2GTablesUpdatesReader.ServerTime to get the current server time. Server time updates can be received with offer updates. The updates come twice a minute regardless on whether there are offers updates or not. So even there are no offer updates, you can define whether the minute should be closed.

frAnton wrote:Another question, the time stamp on a ticks, where it comes from? At what point the tick is being stamped with time?

This time is the server time when a tick has been formed.

I hope this will help
sunshine
 

Re: Last Completed Candle ?

Postby allpin » Wed Aug 24, 2011 8:31 am

It is important to start gathering ticks before the call to get price history to avoid gaps in ticks since getting history takes time. Please remember that in your case you have to get price history for 2 candles of 1-minute history first, use next to last candle from the history as the last completed candle, and add ticks to the last candle from the history. Without getting price history first you will have to disregard your first candle from ticks (it is likely to be incomplete)
allpin
FXCodeBase: Confirmed User
 
Posts: 21
Joined: Thu Aug 19, 2010 3:29 pm

Re: Last Completed Candle ?

Postby frAnton » Wed Aug 24, 2011 9:07 am

sunshine wrote:2) You can use O2GTablesUpdatesReader.ServerTime to get the current server time. Server time updates can be received with offer updates. The updates come twice a minute regardless on whether there are offers updates or not. So even there are no offer updates, you can define whether the minute should be closed.

Hi sunshine,

I did not know that the Offer updates come twice per minute regardless if there was some changes in the table or not. Is it undocumented feature? ;)
Thank you.
Let me have a look if I can use it.

thanks,
Anton.
frAnton
 
Posts: 74
Joined: Tue Apr 05, 2011 11:41 pm
Location: California

Re: Last Completed Candle ?

Postby allpin » Wed Aug 24, 2011 10:36 am

Hi Anton,
If you wish to use our application http://www.fxcodebase.com/code/viewtopic.php?f=27&t=4685 for your purposes, you can do it. I have added additional option for configuration file:
<NeedLastCompletedCandle>Y</NeedLastCompletedCandle>. If the value is 'y' or 'Y', the last completed candle will be shown on the screen, and offers would not be shown, default is 'N' ('User needs forming candles as well'). Please use <NumBars>2</NumBars> if all you need is the last completed candle.
allpin
FXCodeBase: Confirmed User
 
Posts: 21
Joined: Thu Aug 19, 2010 3:29 pm

Re: Last Completed Candle ?

Postby frAnton » Wed Aug 24, 2011 11:09 pm

allpin wrote:Hi Anton,
If you wish to use our application http://www.fxcodebase.com/code/viewtopic.php?f=27&t=4685 for your purposes, you can do it. I have added additional option for configuration file:
<NeedLastCompletedCandle>Y</NeedLastCompletedCandle>. If the value is 'y' or 'Y', the last completed candle will be shown on the screen, and offers would not be shown, default is 'N' ('User needs forming candles as well'). Please use <NumBars>2</NumBars> if all you need is the last completed candle.


Hi allpin,

thank you very much for your help. I will have a look at the code of your example for sure. But it seems to me that I have found how to put the Client and the Server timers in sync by using TableUpdateReader.ServerTime.
I assume though that O2GTablesUpdatesReader TableUpdateReader.ServerTime represents the actual server time and not the time the tick has been stamped on, is that right?

And just one more question - does it have any delays between time-stamping of the tick and sending it to the client?

thanks,
Anton.
frAnton
 
Posts: 74
Joined: Tue Apr 05, 2011 11:41 pm
Location: California

Re: Last Completed Candle ?

Postby sunshine » Thu Aug 25, 2011 7:50 am

frAnton wrote:I assume though that O2GTablesUpdatesReader TableUpdateReader.ServerTime represents the actual server time and not the time the tick has been stamped on, is that right?

Yes, it's actual server time.

frAnton wrote:And just one more question - does it have any delays between time-stamping of the tick and sending it to the client?

You can get a tick which differs from actual time in a second or two at most. Note that the server uses tick time when forming a candile.

frAnton wrote:I did not know that the Offer updates come twice per minute regardless if there was some changes in the table or not.

I've mistaken, sorry. Server time updates can be received on event 'onTableUpdates' twice per second. How frequently the updates will come is defined on the server. That is, It is the server setting rather than API feature.
sunshine
 

Re: Last Completed Candle ?

Postby frAnton » Fri Aug 26, 2011 3:11 pm

sunshine wrote:You can get a tick which differs from actual time in a second or two at most. Note that the server uses tick time when forming a candile.

Hi sunshine,

let me ask you how many ticks per second the Server can generate? Do you guys know what is the more or less reasonable and real number? Does it have a limit?

thanks,
Anton.

Added:
Thank you very much, I found a way to implement last completed candle on the Client side.
A.
frAnton
 
Posts: 74
Joined: Tue Apr 05, 2011 11:41 pm
Location: California

Re: Last Completed Candle ?

Postby Bebbspoke » Fri Sep 23, 2011 2:31 am

Hi Anton, - please, have you identified a work-round for the timing issues as yet? - I konw my software writer cracked the similar problem in O2G but O2G is so archaic and problematic in other ways so we decided to rewrite the robot in FXConnect.
I would be most interested to hear if you have a functioning robot in FXConnect - I'm not interested in your trading algorithms - I just would like to know if you've solved the place Symbol, Entry, Stop Loss & Limit and cancel order operations along with the pip size, MMR etc.
Regards, Bebbspoke
User avatar
Bebbspoke
FXCodeBase: Confirmed User
 
Posts: 170
Joined: Tue Aug 16, 2011 4:04 am
Location: Walton on the Naze UK

Re: Last Completed Candle ?

Postby frAnton » Fri Sep 23, 2011 5:45 pm

Bebbspoke wrote:Hi Anton, - please, have you identified a work-round for the timing issues as yet? - I konw my software writer cracked the similar problem in O2G but O2G is so archaic and problematic in other ways so we decided to rewrite the robot in FXConnect.

Hi Bebbspoke,
It was not actually a problem with the timing. It was a problem with my understanding of how to process incoming data. The easier way was to ask FxConnect developers to come up with the way of generating the very last completed candle.( Actually that wouldn't be a solution but just a patch to the sync issue I had. )
After I figured out that there cannot be any reliable synchronization done between the Server and the Client, everything became much more clear. I had to just reorganize my code a little bit, and now I am closing 1m, 5m, 15m, 30m, 1h and 4h candles right how the TS2 does it.

Bebbspoke wrote:I would be most interested to hear if you have a functioning robot in FXConnect - I'm not interested in your trading algorithms - I just would like to know if you've solved the place Symbol, Entry, Stop Loss & Limit and cancel order operations along with the pip size, MMR etc.
Regards, Bebbsptoke

I have a prototype written with O2G. It was not bad. But with the new FxConnect API it is much more easy and I would say much more logical to do development. The only problem I have is that I cannot open Sell orders for the MarketRange order type...
But it is going to be fixed sooner or later. Beside that, yes my Client works so far as expected.

regards,
Anton.
frAnton
 
Posts: 74
Joined: Tue Apr 05, 2011 11:41 pm
Location: California

Re: Last Completed Candle ?

Postby Bebbspoke » Fri Sep 30, 2011 2:45 am

PLEASE - all that is needed is a LIVE flag or ping from the datastream to clock the COMPLETION of the (most recent) LAST Bar/Candlestick - this would make robot synchronization so much easier....
User avatar
Bebbspoke
FXCodeBase: Confirmed User
 
Posts: 170
Joined: Tue Aug 16, 2011 4:04 am
Location: Walton on the Naze UK

PreviousNext

Return to ForexConnect API

Who is online

Users browsing this forum: No registered users and 4 guests