SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Oct 13, 2024 4:38 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Mon Oct 24, 2011 7:23 am 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
Hi, while I am on paper trading mode and receiving market data from my custom user provider,
I try to view the 1-min candlestick chart of one instrument and it looks like this:
Image

as u see, only Close(Last) data is shown on each bar, when new trade is coming, the last bar changes to the new price, but the open, high and low data do not correctly show. I've tried OHLC bar but the result is the same.

In the solution's market data configuration, I selected two market data: Trade and Bars 1 min. The Bars 1 min data is built from trades. (the property "Build bar from trades" is selected).

My custom user provider only receives and emits trade data (base.EmitNewTrade()). And I have checked the trade data in data manager, the trades are recorded correctly.

Is it because I didn't emit bar data in my user provider or I should not use build bar from trades in solution config?


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 7:48 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Hi,

it looks like all trades within a bar have the same price (O=H=L=C). Could you print out what you emit in EmitNewTrade (i.e. print out trades that you pass to this method call) in your custom data provider?

Regards,
Anton


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 8:02 am 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
Thanks for your reply, Anton
I guarantee that there are different prices in a bar, because I see the bar "MOVING" vertically while new trade arrives. But the old data in the same minute are lost.
The left pic is the trade data I recorded using Data Capture, right is the chart data I was seeing.
Image


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 8:07 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Strange. What happens if you run simulation with captured trades? Would you see the same or correct bars?


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 8:11 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Also, check that you have correct Input in BarFactory settings (i.e. trades).


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 8:29 am 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
The chart displays correct candlesticks while in history data simulation.

I've checked the barFactory settings and it's set to "Trade".

If I remember correctly, in an old version of OQ, the last candlestick bar does not show until the current minute is passed (in Live/Paper mode). But I am surprised to see that the chart draws the last bar as soon as the first trade data in this minute arrives and continues to update the last bar, although it only displays the last trade :lol:


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 8:45 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
I've forwarded this issue to our developers, let's see what they say. But could you print out trades that you pass to EmitNewTrade. This would be helpful.


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 8:51 am 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
you mean that I add Console.Writeline(trade info) while EmitNewTrade(trade info), and post the records?


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 8:59 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
yes, add Console.WriteLine before EmitNewTrade line.


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 9:49 am 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

In your custom UserProvider - which datetime do you pass as a parameter to the EmitNewTrade method? Is it Clock.Now, DateTime.Now or something else?

Regards,
Sergey.


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 10:05 am 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
Baraz Sergey wrote:
Hi,

In your custom UserProvider - which datetime do you pass as a parameter to the EmitNewTrade method? Is it Clock.Now, DateTime.Now or something else?

Regards,
Sergey.


Hi, Sergey
My provider's trade data structure includes time, so I used the trade data's datetime. Should I use something else?


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 10:39 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Yes, Clock.Now


Top
 Profile  
 
PostPosted: Tue Oct 25, 2011 5:09 am 
Offline

Joined: Mon Feb 21, 2011 10:46 am
Posts: 48
I've used Clock.Now and the problem solved. But by using Clock.Now, the trade data's datetime is incorrectly recorded from my computer's local time, which is different from the time I received from the broker, which I believe is more accurate.
Another thing is that the live candlestick chart's last bar stopped auto updating while receiving new trade data. I missed the time when I didn't use Clock.Now and the chart could update the last bar and indicators. :cry:
My suggestion is that you could consider adding this feature of updating the last bar and the indicators on receiving new trades of the last bar. I guess you use ZedGraph as the chart control, which I have used in my own chart-displaying application. It's not difficult to update and refresh the last bar data.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group