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

Notification

Icon
Error

Options
Go to last post Go to first unread
crwinnr5  
#1 Posted : Friday, November 18, 2005 1:47:24 AM(UTC)
crwinnr5

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/21/2005(UTC)
Posts: 74
Location: Oklahoma USA

Help I have this Excel formula that I need to convert to Metastock: Signal is in column H =if(previousvalue<close,1,0) Value is in column I =if(signal=1,if(close*percent1<previousvalue,previousvalue,close*percent1),if(close*percent2>previousvalue,previousvalue,close*percent2) I located the following formula but it only gives me binary values - I need the values computed on price. If(PREV = 1, If(CLOSE < HighestSince(1,PREV <> 1,CLOSE)*.985, -1,PREV), If(PREV = -1, If(CLOSE>LowestSince(1,PREV <> -1,CLOSE)*1.015, +1,PREV), If(PREV = 0, If(CLOSE>Lowest(CLOSE)*1.015, +1, If(CLOSE<Highest(CLOSE)*.985, -1, PREV)),PREV))) I have tried HighestSince, ValueWhen, etc. but it does not give me the same value as the Excel formula generates. I am currently linking Excel data to Metastock but really would lke to compute this in Metastock. Any assistance is greatly appreciated. Charley
mstt  
#2 Posted : Wednesday, November 30, 2005 2:21:34 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Charley Forgetting Excel, can you explain in English what this is supposed to do? I'd rather start from scratch with a logical explanation than try and untangle 9 PREVs that don't do the job properly. I may be able to figure out the Excel code but I'd rather get a clear understanding of the purpose of this exercise and go from there. Roy
crwinnr5  
#3 Posted : Wednesday, November 30, 2005 3:03:39 AM(UTC)
crwinnr5

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/21/2005(UTC)
Posts: 74
Location: Oklahoma USA

I will try Roy, actually that is what I was trying to describe in the Excel formula I posted. This is an always in system I modified from Larry William's Definative Guide to Futures Trading Vol 1, pp141-144. The signal is always a Buy or Sell. A buy is triggered when the current close is greater than yesterday's computed stop value. The reverse for a Sell. If the current signal is a Buy, it computes today's close times a percent (i.e. .985) and compares to yesterday's value. If the computed value today is lower than yesterday, it keeps yesterday's value. Otherwise it uses the value computed today. If the current signal is a Sell, it computes today's close times a percent (i.e. 1.015) and compares to yesterday's value. If the computed value today is greater than yesterday, it keeps yesterday's value. Otherwise it uses the value computed today. Here is a sample from my Excel worksheet: Date Open High Low Close Signal Stop Value 11/10/2005 1629.56 1651.05 1620.74 1650.93 B 1626.17 11/11/2005 1653.41 1659.72 1651.09 1653.36 B 1628.56 11/14/2005 1653.65 1657.53 1648.26 1651.9 B 1628.56 11/15/2005 1651.97 1658.65 1638.97 1644.31 B 1628.56 11/16/2005 1648.92 1653.74 1642.36 1651.45 B 1628.56 11/17/2005 1659.16 1676.39 1657.27 1676.39 B 1651.24 11/18/2005 1685.05 1689.59 1674.75 1679.85 B 1654.65 11/21/2005 1678.7 1686.79 1673.05 1686.23 B 1660.94 11/22/2005 1686.23 1688.23 1679.73 1680.23 B 1660.94 11/23/2005 1691.96 1704.42 1691.08 1696.77 B 1671.32 And I have attached a screen shot. I hope this is clear, Charley
mstt  
#4 Posted : Wednesday, November 30, 2005 3:25:59 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Charley No promises but I'll see if I can nut something out later tonight. Roy MetaStock Tips & Tools
mstt  
#5 Posted : Wednesday, November 30, 2005 9:31:34 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Charley Is this close to what you're looking for? It has 5 PREVs so you should be careful about the amount of data you open. P1:=0.985; P2:=1.015; Bar1:=Cum(1)=1; Bar2:=Cum(1)=2; Close1:=LastValue(ValueWhen(1,Bar1,C)); Close2:=LastValue(ValueWhen(1,Bar2,C)); StartValue:=If(Close1<Close2,C*p1,C*p2); Trail:=If(Bar1,StartValue, If(PREV<C, If(C*P1<PREV,PREV,C*P1), If(C*P2>PREV,PREV,C*P2))); Trail; Roy MetaStock Tips & Tools
crwinnr5  
#6 Posted : Wednesday, November 30, 2005 10:06:45 PM(UTC)
crwinnr5

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/21/2005(UTC)
Posts: 74
Location: Oklahoma USA

Thanks Roy!!! I have been toying with this for some time but just could not get it right. I do not think I would have solved it without the forum and your help. Your numbers agree with the Excel computations. I only trade the Indexes so the amount of data is not a problem with the Prev function - I do not mind the slight delay. Maybe some day MSFL can do loops. Thanks again, Charley
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.