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

Notification

Icon
Error

Options
Go to last post Go to first unread
mattblackman  
#1 Posted : Wednesday, April 2, 2008 12:55:33 AM(UTC)
mattblackman

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/7/2005(UTC)
Posts: 1

I have been searching for a way of using market timing lists to buy, sell, sell short and buy to cover in the Enhanced System Tester.

Have tried various permutations of this but it is both cumbersome and doesn't work.... The market timing list I want to test has more than 50 buy, cash and sell dates....
-------------------------------------
BUY

If((Year()=2005 AND Month()=10 AND DayOfMonth()=19) OR (Year()=2005 AND Month()=11 and DayOfMonth()=30) OR (Year()=2005 AND Month()=12 AND DayOfMonth()=1) OR (Year()=2005 AND Month()=12 AND DayOfMonth()=16) OR (Year()=2006 AND Month()=4 AND DayOfMonth()=12 OR (Year()=2006 AND Month()=5 AND DayOfMonth()=2)),1,0)

SELL

If((Year()=2005 AND Month()=11 AND DayOfMonth()=30) OR (Year()=2005 AND Month()=12 and DayOfMonth()=14) OR (Year()=2006 AND Month()=4 AND DayOfMonth()=5) OR ((Year()=2006 AND Month()=4 AND DayOfMonth()=19) OR (Year()=2006 AND Month()=4 AND Month()=5 AND DayOfMonth()=8) OR (Year()=2006 AND Month()=4 AND Month()=5 AND DayOfMonth()=11)),1,0)

------------------------

Thanks!

Cheers,
Matt Blackman
wabbit  
#2 Posted : Thursday, April 3, 2008 7:13:20 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)
Hi Matt,

Welcome to the Forum.

There are a few ways to tackle this:

The first is to better organise the logic of your entry and exit dates to make coding and management in MSFL easier, and avoid mistakes. Try grouping the dates by the longest term factor first i.e. years, then if necessary months, then days, hours, minutes etc. Also MS returns a boolean value of 1 or 0 depending on whether a condition can be expressed as true or false, so you dont need the If(something,1,0).

e.g.

Code:

{BUY}
If((Year()=2005 AND Month()=10 AND DayOfMonth()=19) OR (Year()=2005 AND Month()=11 and DayOfMonth()=30) OR (Year()=2005 AND Month()=12 AND DayOfMonth()=1) OR (Year()=2005 AND Month()=12 AND DayOfMonth()=16) OR (Year()=2006 AND Month()=4 AND DayOfMonth()=12 OR (Year()=2006 AND Month()=5 AND DayOfMonth()=2)),1,0)


should have the same logic as:

Code:

{BUY}

(Year()=2005 AND
(Month()=10 AND DayOfMonth()=19) OR
(Month()=11 and DayOfMonth()=30) OR
(Month()=12 and (DayOfMonth()=1 or DayOfMonth()=16))
)
OR
(Year()=2006 AND
(Month()=4 AND DayOfMonth()=12) OR
(Month()=5 AND DayOfMonth()=2)
)

note: this code was written in notepad and untested, so check the right number of brackets etc. but you should get the idea?

What are these dates? Is there some pattern to them that could be programmed? This is much preferred to maintaining a list.


The second way to do this would be to write an extrnal function to read the dates from a file or other extrnal source. This would require some extra programming knowledge and the MDK.


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.