Rank: Member
Groups: Registered, Registered Users Joined: 3/4/2006(UTC) Posts: 16
|
Hi
I am running an exploration and in my results I would like to show 1 column with the date. Currently, I have add 3 columns with :
Col D - LastValue(DayOfMonth())
Col E - LastValue(Month())
Col F - LastValue(Year())
But is it possible to combine these in 1 column to show like DD-MM-YYYY?
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 3/4/2006(UTC) Posts: 16
|
I found this idea at:
http://www.metastocktools.com/MetaStock/DateEvent.txt
.............
LastValue(DayOfMonth())*1000000+LastValue(Month())*10000+LastValue(Year())
gives
13042007
The only problem is the reason I want this is because I am copying the results into MS-Excel. unfortunately, Excel doesn't recognise this format...
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 3/4/2006(UTC) Posts: 16
|
OK I found an answer to my problem. The following Excel VBA code will convert :
13042007
into 13/04/2007
I apologize for having this conversation with myself in a public forum (I have been known to mutter to myself in public too). Hopefully, I will get better.
found at :
http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr06/hey0407.mspx
'******************************************************
Private Sub btnConvertDate_Click()
' First cell with number to convert
intRow = 2 intCol = 7 i = 0
Do Until Cells(intRow, intCol).Value = "" strDate = Cells(intRow, intCol).Value i = Len(strDate) If i > 6 Then dtYear = Right(strDate, 4) i = i - 5 Else dtYear = Right(strDate, 2) i = i - 3 End If dtDay = Mid(strDate, i, 2) i = i - 1 dtMonth = Left(strDate, i) newDate = dtMonth & "/" & dtDay & "/" & dtYear
Cells(intRow, intCol).Value = newDate intRow = intRow + 1 Loop
End Sub
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/7/2005(UTC) Posts: 1,346
|
hey digbee..... sounds like you have a solution but i was wondering, is there a reason you need the date in the dd-mm-yyyy format....
meta automaticaly supplys the date in the mm/dd/yyyy such as below.... it works well with excel......h
Date
macd
stoch
rsi
close
2/21/2007
-1.2149
151.4146
50.2473
89.2
2/22/2007
-0.8604
196.7874
51.207
89.51
2/23/2007
-0.6051
168.9672
49.7405
89.07
2/26/2007
-0.4395
121.8332
47.8619
88.51
2/27/2007
-0.6478
-67.5662
35.9145
83.93
2/28/2007
-0.7533
-79.1154
38.3741
84.61
3/1/2007
-0.6441
11.2837
46.362
87.06
3/2/2007
-0.6747
-10.2796
42.3781
85.41
3/5/2007
-0.6229
7.7461
45.1758
86.3199
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 3/4/2006(UTC) Posts: 16
|
Hayseed
That is exactly what I am looking for. How did you do that? I see no Date function? When I look at my exploration results i see no date????
Dig
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/7/2005(UTC) Posts: 1,346
|
hey digbee..... if for instance we run the the equis exploration 'equis-indicators 5 popular' on the nasdaq 100, it will return a single row for each security for the last day available....
in those returned results, double click on one security and a second pane comes up called ' exploration security column data' which lists every days results for that security..... you'll note there is no copy tab and if you try to right click and copy , that won't work.....
instead click on the top row to highlight it and then click both the 'ctrl' key and 'c' at the same time...... it appears nothing has happened, but you have actually copied all those results..... paste that into excell.....
holler back if ya still have problems......h
editted my error, should be 'ctrl' control key, not shift..... thanks wabbit.....h
|
|
|
|
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)
|
hayseed wrote:instead click on the top row to highlight it and then click both the 'shift' key and 'c' at the same time...... it appears nothing has happened, but you have actually copied all those results..... paste that into excell..... h, You must have a left-handed operating system! For me to copy the information to the clipboard, I have to use "Ctrl-C" ;) wabbit [:D]
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/7/2005(UTC) Posts: 1,346
|
hey wabbit.... thanks your correct.... was working on metastock, metaquotes, eating supper and watching the scifi channel all at the same time.... i just lost 'control' of my typing finger.......h
|
|
|
|
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)
|
SWMBO (She-Who-Must-Be-Obeyed) says that men cannot mulitask.
She's right. I can't watch sport on TV and listen to her at the same time!
wabbit [:D]
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 3/4/2006(UTC) Posts: 16
|
I See ! Thanks!
It would be easier if there was a date field in the first results window, since I am cutting and pasting these results into excel. However, its not really any trouble to enter the date at the same time either.
Dig
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 3/4/2006(UTC) Posts: 16
|
I've got another problem with my date. The following was working fine earlier in the month:
LastValue(DayOfMonth())*1000000+LastValue(Month())*10000+LastValue(Year())
But lately, its been giving me the year 2008. So I tried the following with surprising results (maybe not to everyone...)
in column A
03*1000000+04*10000+2007 = 3042007
in column B
23*1000000+04*10000+2007 = 23042008
Is it possible Metastock has some kind of bug that would cause such an error? Am I missing something??
Dig
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/7/2005(UTC) Posts: 1,346
|
hey digbee ..... roy, henry, jose and wabbit had pointed that out to me a while back about a date formula i was using....
my formula did work but they pointed its best not to use quite that many digits...... has something to do with precision errors......
you can read their suggestions and concerns about date formulas here.....h
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 3/4/2006(UTC) Posts: 16
|
Thanks for the info. The precision thing makes sense.
This brings up a new question though. When I use the export (or Convert) to ASCII under the Downloader, one of the fields exported is the date. Its in the form:
YYYYMMDD (e.g. 20070105)
Would there not be precision errors here as well? I guess I will assume not until proven otherwise.
Dig
|
|
|
|
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.