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

Notification

Icon
Error

Options
Go to last post Go to first unread
Peredur  
#1 Posted : Wednesday, February 6, 2008 11:33:37 AM(UTC)
Peredur

Rank: Newbie

Groups: Registered, Registered Users
Joined: 2/6/2008(UTC)
Posts: 2

Hi to everyone,

This is a quick query whether the MS programming code is able to carry out a specific type of time calculation.

Very simply, if I input a time on which the calculation is to begin, say, 8.10am, and I then want to add a period of time (say, 29mins, 1hr 35mins, etc, etc) to the 8.10am and have a very simple +1 plot on the chart when and where this time period has been calculated, I'm wondering whether MS has the resources to do this relatively simple sounding task.

The easy part of the code to obtain start times of, say, 8.10am on a specific day is obviously this:

sm:=Input("starting month",1,12,1);
sd:=Input("starting day of month",1,31,1);
sy:=Input("starting year",1980,2100,2008);
sh:=Input("hour", 1,24,1);
se:=Input("minute",0,60,0);

start:= sd=DayOfMonth() AND sm=Month() AND sy=Year() AND sh=Hour() AND se=Minute();

However, as I stated above I don't know of a way of simply adding, say, 29 minutes to a start time such as 8.10am and I'm wondering whether the MS code has the resources to do this or whether I'd need to create an external dll.

To those who may be interested, numbers to add to the start such as 29 minutes are square roots of Fibonacci numbers in a simple additive sequence. These square root calculations can be done outside of the MS code and can simply be plugged in later. The main problem is knowing what to do with the code (if it can be done) to add them to selected starting times such as 8.10am.

The whole thing is pretty easy to create in Excel, but I wanted to do it in Metastock Pro to do some real-time testing on very short term charts (1m ideal). The automated signals that would be produced through the "+1 plot" are much easier to work with than having to move back and forth from Excel to the charts. Besides, if the extension of these square root calculations from daily charts to the intraday timeframe does work (to be determined after sufficient testing), the calculations will need to be automated in any case because they need to be updated throughout the trading day and this is too laborious to do in Excel.

Thanks in advance if anyone is able to help ...

Peredur

johnl  
#2 Posted : Tuesday, April 1, 2008 5:15:54 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

Can you use the BarsSince function? Create a spike (1 or 0) at 8:10, then use
BarsSince to see if the current period meets your criteria (if BarsSince(bla bla) = 29
etc, then do this (yak yak).
Sorry for not being more specific.

wabbit  
#3 Posted : Thursday, April 3, 2008 7:43:27 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)
Peredur,

Handling dates and times in MSFL is not impossible, it is just a bit "clunky" For an example to see how to add three months to a date, see the previous works from a while ago at http://forum.equis.com/forums/permalink/17562/17081/ShowThread.aspx#17081odes, simply because it is easier and much less prone to error, and faster to execute than MSFL.

Another consideration is to use the OLE capabilities to display the excel chart information in MS. Read your MS Users Manual for more informationon how to achieve this.


Hope this helps.

wabbit [:D]
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.