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

Notification

Icon
Error

Options
Go to last post Go to first unread
Magnus  
#1 Posted : Sunday, September 10, 2006 7:13:34 AM(UTC)
Magnus

Rank: Member

Groups: Registered, Registered Users
Joined: 9/10/2006(UTC)
Posts: 11

I am a beginner with MetaStock trying to learn as much as I can. What I want to do is the following: I have 6 months of data for a stock, with open and close prices. Now I want to run something in the Enhanced system Tester with two different strategies, both starting long in a stock. When day 1 closes - If it closes above the opening price I want Portfolio A to stay in the position and Portfolio B to sell. And vice versa, If it closes below the opening price i want port. a to sell and port. b to stay. And then at the end of the 6 month period I want to measure which strategy proved to be the most efficient. basically, price goes up - portfolio A buys/stays in the postion & portfolio b sells Price goes down - portfolio a sells & portfolio b buys/stays any idea on how to do this? I appreciate all the assistance I can get. Thanks in advance, I am using Metastock 9.0
Magnus  
#2 Posted : Sunday, September 10, 2006 4:42:12 PM(UTC)
Magnus

Rank: Member

Groups: Registered, Registered Users
Joined: 9/10/2006(UTC)
Posts: 11

I have come to the point so that I have realised I need If C is larger than yesterday then keep the investment If C is smaller than yesterday then sell But how do I write it in code?
Bulli  
#3 Posted : Sunday, September 10, 2006 5:09:01 PM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

Hi Magnus,

Reading the Formula Premier will help you a lot.

It is available from Equis and can be downloaded from the site here!

http://forum.equis.com/files/3015/metastock_files/entry19673.aspx

Just to give you a quick hand here is the code you need:

C> ref(C,-1)

C< ref(C,-1)

Bulli

wabbit  
#4 Posted : Sunday, September 10, 2006 5:27:34 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)
Magnus,

I am assuming that you will be entering/exiting each trade on the next day? With brokerage? Slippage?

If you really want to know the cumulative sum of the difference between today's close and yesterday's close, jut use Cum(C-Ref(C,-1)) as an indicator or in an exploration without clouding the information. Use your analytical skills, if the return is positive... if the return is negative... if the return is zero...

Please have a thorough read of the MS Users Manual which will guide you through creating your own System Tests, Explorations, Expert Advisors and Indicators. Once you have read the Manual, download the free Equis Formula Primer from the downloads section of the Forum and work your way through that. These exercises may not help you with you logic, but will assist you to convert your ideas into MS code.


wabbit [:D]
Magnus  
#5 Posted : Monday, September 11, 2006 2:14:32 AM(UTC)
Magnus

Rank: Member

Groups: Registered, Registered Users
Joined: 9/10/2006(UTC)
Posts: 11

A Big thanks to both of you. I am currently trying to learn the Formula Primer and it is going allright. What we want to do is, if the price of a security is higher today than yesterday then port. a buys that security for every day that this happens during a certain time period. and port. b only buys when price is lower than yesterday. Then we check the performance of these two strategies at the end of the period. I will try to implement the code you two gave now. Again, Thanks alot
Magnus  
#6 Posted : Monday, September 11, 2006 6:23:30 AM(UTC)
Magnus

Rank: Member

Groups: Registered, Registered Users
Joined: 9/10/2006(UTC)
Posts: 11

I implemented the following code in the enhanced system tester C> ref(C,-1) = this is the buy code C< ref(C,-1) = this is the sell code The things that came out were good but not really what I was looking for. What I want is two different strategies. When one strategy buys, I want the other one to sell and vice versa. Strat 1, only buys if todays close price is higher than yesterdays. Is this feasible to implement and how? I am trying to learn by studying the code but any help I can get is very much appreciated. Thanks
wabbit  
#7 Posted : Monday, September 11, 2006 11:00:45 AM(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)

Magnus,

Why are you trying to do this in the system tester? I think you will be better off using an indicator to do a comparison of the up days versus the down days.

How are you considering trading your "system" in real life? You cannot know the daily closing price until the end of the day, so the next buying opportunity is at the open the following day; versa for trade exits. Are you taking this into account in your System Tester setup? If you mean to buy and sell two systems on an avererage daily basis, the only person who will be making any money will be your broker!

I have mentioned in an earlier post; if you want to compare up days vs down days use Cum(C-Ref(C,-1)) in an indicator and interpret the results. This is MUCH faster than using the System Tester.

wabbit [:D]

Magnus  
#8 Posted : Monday, September 11, 2006 3:13:49 PM(UTC)
Magnus

Rank: Member

Groups: Registered, Registered Users
Joined: 9/10/2006(UTC)
Posts: 11

My apologies. This is not somethingI am planning to implement in real life. It is for theoretical use only. I am doing a project on different trading strategies. And this specific project, I am trying to investigate if a "minority" strategy (i.e the one that buys when the dominant strategy sells) is a succesful strategy or not. Hence, I am trying to learn Metstock and illustrate the problem with metastock. The data that will be used is historical data only and therefore I want to be looking at the close price only. So I thought that the sysmte tester would be perfect for testing these strategies since that would give me data of the performance at the end of the time period. Am I right or wrong here?
Magnus  
#9 Posted : Tuesday, September 12, 2006 3:25:49 AM(UTC)
Magnus

Rank: Member

Groups: Registered, Registered Users
Joined: 9/10/2006(UTC)
Posts: 11

I have come a bit on the way although it does not work the exact way I want it to. I want both strategies to buy at starting day 1. At the end of day 1, if the security closes on higher than what I bought for strat. 1 holds the security and strat two sells. So far I have only managed to get these merged into one strategy. So it buys high and sells low. How do I separate the two in the system tester? Is there a formula for this?
Magnus  
#10 Posted : Wednesday, September 13, 2006 8:45:08 AM(UTC)
Magnus

Rank: Member

Groups: Registered, Registered Users
Joined: 9/10/2006(UTC)
Posts: 11

How do I tell the enhanced system tester to buy ONLY when todays clsoe price is higher than yesterdays close price and ONLY sell when the close price is lower than the day before? I am having problems with that one.
Magnus  
#11 Posted : Thursday, September 14, 2006 6:30:28 AM(UTC)
Magnus

Rank: Member

Groups: Registered, Registered Users
Joined: 9/10/2006(UTC)
Posts: 11

Anyone? hello?
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.