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

Notification

Icon
Error

Options
Go to last post Go to first unread
wuming79  
#1 Posted : Saturday, March 6, 2010 7:15:00 PM(UTC)
wuming79

Rank: Member

Groups: Registered, Registered Users
Joined: 8/23/2008(UTC)
Posts: 25
Location: Singapore

Hi,

I was reading the link below.

http://www.visualchart.com/enxx/strategies/indicators/ayuda.asp?Id=2785

Technical Reference

Mansfield calculates every week the relation between the weekly close of the share and the weekly close of it corresponding index. He extracts form there the arithmetic average of the last 52 weeks ( the full chart has 130 bars , this is two years and a half. This value will be the base price . Base price = = ( R (1)+ R (2) +.... + R (t)+....+R (52) ) / 52 The chart performance ratio is the representation of PR (t) = (( R (t) / BP) -1 ) x 10 The coefficient 10 is a scale factor arbitrary chosen by Mansfeld.


Data Output

Line 1 : Represents the indicator value.
Line 2 : Represnts the 0 value band the indicator oscillates around.
How do I calculate the base price and the PR(t) mentioned in the article?

Regards,
Lewis
v.trader  
#2 Posted : Saturday, March 6, 2010 9:09:50 PM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

Here's the indicator that I created based on the article. I tried it, it works, check it out: {Relative Strength Mansfield} x:= Security("SPY",C); y:= Input("Periods for Ratio",0,9999,1); z:= Input("Periods to Sum up", 1,9999,52); R:= C/x; base:= Sum(R,z)/z; mf:= ((Ref(R,-y)/base)-1)*10; mf;0; I think that the "Security" function gets introduced after version 7 of metastock, if you don't have this function you will have to use the "P" variable. Also, I have used the SPY security which is the ETF for the S&P but you can substitute this for any other ETF of an index or if you have data for indexes you could directly input them. It should not make a difference since the "R variable" is a ratio. VT
wuming79  
#3 Posted : Saturday, March 6, 2010 11:01:55 PM(UTC)
wuming79

Rank: Member

Groups: Registered, Registered Users
Joined: 8/23/2008(UTC)
Posts: 25
Location: Singapore

Hi VT,

I got an error message when trying out this forumla above.

It says

UserPostedImage

Do you encounter this message?
I don't quite understand the use of the "P" variable. Do you mean create a variable "P" to be SPY?
v.trader  
#4 Posted : Sunday, March 7, 2010 9:04:53 AM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

No, i don't encounter this message.Alright, so I guess you don't have the specific security e.i. SPY but try substituting it for whatever index you usually open. I'm not quite sure that it would work out with P so I really encourage you to figure out the problem with the "Security" function. Just try changing the symbol of "SPY" with any other symbol and see if it works. VT
v.trader  
#5 Posted : Sunday, March 7, 2010 9:11:07 AM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

Alright, I just found out how you can fix the problem. Whenever you are comparing a stock, you have to make sure that the index you are comparing the security against, is LOCATED IN THE SAME folder as the security that is open. So for example, if you are looking at Apple(AAPL) and this stock is in the folder named "NASDAQ", the index you are comparing it against, e.i. SPY must also be in the folder "NASDAQ". This should solve your problem. VT
wuming79  
#6 Posted : Sunday, March 7, 2010 6:13:17 PM(UTC)
wuming79

Rank: Member

Groups: Registered, Registered Users
Joined: 8/23/2008(UTC)
Posts: 25
Location: Singapore

Oh man, here another problem. How do I identify which file is the SPY file in Metastock? I have G:\Invest\Metastock\US1 and G:\Invest\Metastock\US2 and G:\Invest\Metastock\US2 is where SPY is but the files are all named as F[censored]X.MWD.

Another question I have is, if I were to use it in explorer, how do I set the filter of

AND (Manfield RS > ref(Manfield RS, -7))? How do I make the whole newly constructed indicator as a function for filtering? I tried making Relative Strength Manfield as a fml and created another indicator with formula like Fml("Relative Strength Manfield") but it just drew a straight zero line.


v.trader  
#7 Posted : Sunday, March 7, 2010 6:46:39 PM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

No man don't check it through you hard drive, check the security name and folder directly through metastock. Go to new chart and see in which folder is your SPY symbol or another index. With regards to the explorer, here you can use your P variable. Here is how its done: Copy this code to the FILTER tab of a New Explorer: x:= P; R:= C/x; base:= Sum(R,52)/52; mf:= ((R/base)-1)*10; mf>Ref(mf,-7) Now before you run the exploration open a chart of any index or etf, for example SPY. Then click on the actual security and you should see white squares(or at least mine are white) on the data. These squares define the P variable. Now, with the squares still on the index/etf run the exploration and you should get the result you are looking for. Note a few things. First, with the P variable defined it is NOT necessary to open securities from the same folder in which the index is. In addition, you should notice that I have changed the formula slightly- I have defined directly the periods with which to sum up and the periods which to define R in the formula. If you want to make any adjustments you should changed them manually in the explorer. Hope it works. VT
wuming79  
#8 Posted : Tuesday, March 9, 2010 12:46:38 AM(UTC)
wuming79

Rank: Member

Groups: Registered, Registered Users
Joined: 8/23/2008(UTC)
Posts: 25
Location: Singapore

Hi VT,

I go to new chart and saw SPY symbol is in G:\Invest\Metastock\US2.

Do I replace "SPY" as below? anyway, now it works even with just "SPY". Weird.

{Relative Strength Mansfield}
x:= Security("G:\Invest\Metastock\US2\SPY",C);
y:= Input("Periods for Ratio",0,9999,1);
z:= Input("Periods to Sum up", 1,9999,52);
R:= C/x;
base:= Sum(R,z)/z;
mf:= ((Ref(R,-y)/base)-1)*10;
mf;0;

I still don't understand how the P variable works. The above formula works perfectly. Can't we use the formula as a function for the filter?

I'm stuck at "hen click on the actual security and you should see white squares(or at least mine are white) on the data". I opened a SPY chart. Then I open another chart example QCOM and then....what do I do to see the white squares?




v.trader  
#9 Posted : Tuesday, March 9, 2010 7:39:07 AM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

Hi, No don't replace it with the actual directory because Metastock knows where the symbol is and Metastock would not understand this Security("G:\Invest\Metastock\US2\SPY",C). It would give you an error ONLY if you try to apply the indicator to a chart which is NOT in the folder where the index is. For instance, let's say you open a new chart of GOOGLE which is in the folder US1. Now, you are trying to compare it to SPY which is in the folder US2. Metastock would give you an error because it ONLY looks for the symbol SPY in the folder where GOOGLE is - US1 and it can't find it. So that is what i mean by - make sure that the security to which you are applying the indicator is in the same folder as the index which you are comparing it against. With respect the explorer, you should import the formula that I provided specifically for the explorer because the code for the indicator would not work with the explorer. Let me try to explain how the P variable works by example: So you already have the code in the explorer. You close the explorer and open a new chart of any index, for instance SPY. Now you have the chart of SPY in front of you and you LEFT CLICK ONCE on ANY BAR of the chart.(You don't need to open a chart of any other security). Now you should see those squares which basically mean that you have highlighted the data for the index. After you have left-clicked on any bar, you directly (without clicking on anything else) open the explorer, click on the Mansfield exploration and click on explore. Select any security (no mater in which folder is), run the exploration and everything should be fine. The P variable is defined when you LEFT CLICK ONCE ON ANY BAR of the chart. It allows you to use the data for one security to compare it with any another security within the explorer, such as the case with the Mansfield Relative Strength. It is also used for other things but they are not relevant to this discussion.Check it out. VT
wuming79  
#10 Posted : Tuesday, March 9, 2010 7:06:08 PM(UTC)
wuming79

Rank: Member

Groups: Registered, Registered Users
Joined: 8/23/2008(UTC)
Posts: 25
Location: Singapore

Hi VT,

I see what you mean now. You mean the small white squares on the prices right?

Ok, I try to narrow my search by adding the criteria below, but I got a message from Metastock saying that "An '(' must immediately follow a function name."
x:= P;
R:= C/x;
base:= Sum(R,52)/52;
mf:= ((R/base)-1)*10;
mf>Ref(mf,-7)
AND (Close > 20)
AND (Mov(C,30,S) > ref(Mov(C,30,S),-1)
AND (ATR > 0.8)
AND (Volume > 10)

If I add ";" behind each end of line, I will get the message "This AND or OR is being used incorrectly."
x:= P;
R:= C/x;
base:= Sum(R,52)/52;
mf:= ((R/base)-1)*10;
mf>Ref(mf,-7);
AND (Close > 20);
AND (Mov(C,30,S) > ref(Mov(C,30,S),-1);
AND (ATR > 0.8);
AND (Volume > 10);

What is still missing in the equation to make it work properly?
v.trader  
#11 Posted : Tuesday, March 9, 2010 8:07:46 PM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

Yes, exactly those squares. here is the debugged code: x:= P; R:= C/x; base:= Sum(R,52)/52; mf:= ((R/base)-1)*10; mf>Ref(mf,-7) AND (CLOSE > 20) AND (Mov(C,30,S) > Ref(Mov(C,30,S),-1) AND (ATR(14) > 0.8) AND (VOLUME > 10)) Basically, you had forgot to define the periods of the ATR. Let me give you a little hint, whenever a message proms up it means that you have done something wrong or (as in this case) have forgot to add something. Now whenever you see the message, the moment you click ok on the message your typing cursor "|" will be pointing at wherever the error is so you can easily fix it. I had just tried the above formula and it works fine. MAKE SURE to define P (check my previous post on how to). And btw do NOT separate those conditions by";" . ";" is used to evaluate every line separately from the previous which you don't need to do here. Check it out know. VT
mhireche  
#12 Posted : Friday, August 5, 2011 2:43:45 AM(UTC)
mhireche

Rank: Newbie

Groups: Registered, Registered Users
Joined: 8/5/2011(UTC)
Posts: 4

Hello,

I don't understand the y variable "Periods for ratio". What is it exactly and what is the impact if it is not equal to 0 ? What is the normal default value (0 or 1) ? Wich default value should I use to get the indicator as it is represented on Mansfiled charts ?
Is there a specific interest in introducing this variable and having it different from the normal default value ?

Later on in the discussion the y variable has disappeared in the indicator formula, so I assume we get the same result as with y = 0. Can you confirm it ?

Thanks a lot for your help,

mh
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.