logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
DrPain  
#1 Posted : Wednesday, March 4, 2009 6:26:36 AM(UTC)
DrPain

Rank: Member

Groups: Registered, Registered Users
Joined: 7/10/2006(UTC)
Posts: 25

I was noticing some strange values with dates in the MSXDataRec structure, so I plotted them to an indicator to see what was going on. The numbers seem to skip some days.

My platform is MetaStock Pro FX version 9.2
Data is $$EURUSD, 10 minutes

1/06/2009 20090106
1/07/2009 20090108
1/08/2009 20090108
1/09/2009 20090108
1/10/2009 (saturday, no data)
1/11/2009 20090112
1/12/2009 20090112
1/13/2009 20090112
1/14/2009 20090114
1/15/2009 20090116
1/16/2009 20090116
1/17/2009 (saturday, no data)
1/18/2009 20090118
1/19/2009 20090120
1/20/2009 20090120
1/21/2009 20090120
1/22/2009 20090122

I also checked the daily data the same way, with virtually the same results.

Any clue what's going on here? Is this a known problem?

Thanks,
Dave
DrPain  
#2 Posted : Wednesday, March 4, 2009 2:54:43 PM(UTC)
DrPain

Rank: Member

Groups: Registered, Registered Users
Joined: 7/10/2006(UTC)
Posts: 25

Never mind, call off the dogs.

The bad data is occurring because of an error in the conversion between a double and a float with large numbers.

The number gets read in my DLL as a double (passed in from Lua code), and then cast to a float to set the value in the MetaStock indicator. Reading it as a double works fine, but the cast to float is not exact and changes the data.

Now to figure out how to fix it, without breaking other things.
wabbit  
#3 Posted : Wednesday, March 4, 2009 5:10:24 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
DP,

MS doesn't deal well with large numbers anyway; rounding/precision errors start creeping in at the order of 10^7 so any dates using yyyymmdd (i.e. order of 10^8) will be problematic. One way around this is to use a place holder, say 1, then format the date as 1yymm.dd as this has "less" troubles employed in MS.

Hope this helps.

wabbit [:D]

DrPain  
#4 Posted : Thursday, March 5, 2009 11:23:19 AM(UTC)
DrPain

Rank: Member

Groups: Registered, Registered Users
Joined: 7/10/2006(UTC)
Posts: 25

Thanks wabbit. I decided to change the way I deal with dates by breaking the long (from MS) into three values: year, month, day. That fixes the issue I had with bad casts.

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.