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

Notification

Icon
Error

Options
Go to last post Go to first unread
EFHL62  
#1 Posted : Wednesday, May 6, 2009 12:02:41 AM(UTC)
EFHL62

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/6/2009(UTC)
Posts: 9

Thoroughly frustrated at the inability to make even the simplest moving avg function. All I want is an avg of the last 4 day's Highs (incl today). The plot winds up actually below the bars at times. IE, totally off; completely wrong. So frustrating.
Tried a few ways to do this.... Apparently, all wrong!
Tried: Mov(H,3,S) no f'ng good there.
Tried: (Ref(H,0)+Ref(H,-1)+Ref(H,-2)+Ref(H,-3))/4 again, no good. Get system requests for another "," or ")". If something this simple is this hard...
Anyone know how to create something as simple as this?
And what about the Scaling? Perhaps it's because this simple plot is so d*mn difficult for me to create, but the scale keep wanting to change on the stock chart. Ugh!
wabbit  
#2 Posted : Wednesday, May 6, 2009 12:14:25 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)
EFHL62 wrote:
Thoroughly frustrated at the inability to make even the simplest moving avg function. All I want is an avg of the last 4 day's Highs (incl today).


Hi EFHL62

Welcome to the Forum.

First, the code you want for a 4 period SMA of HIGHs is:

Code:
mov(H,4,S);


The next part is to scale the indicator to the same scale as the price data, so if your price data axis is to the right of the chart, you want to select "Merge with scale on right" when you drop your indicator on the chart.

MS Help wrote:
When you copy or move a plot (i.e., price plot or indicator) to another inner window, it is likely that the other inner window's y-axis scale will not be compatible. If this is the case, MetaStock displays the Scaling Options dialog so that you can choose how to handle the scaling when the plot is overlayed.
Display New Scale on Left. Use a new scale on the left side of the chart that is compatible with the new plot. The existing plot will continue to display, but the left y-axis scale represents the new plot.

Display New Scale on Right. Use a new scale on the right side of the chart that is compatible with the new plot. The existing plot will continue to display, but the right y-axis scale represents the new plot.
Merge with Scale on Left. Adjust the existing left y-axis scale so that the new price plot can be represented.
Merge with Scale on Right. Adjust the existing right y-axis scale so that the new price plot can be represented.
Overlay without Scale. Overlay the plot without displaying a scale. You may want to do this if you are only concerned about comparing relative movements between the plots.



Hope this helps.

wabbit [:D]

EFHL62  
#3 Posted : Wednesday, May 6, 2009 7:39:57 AM(UTC)
EFHL62

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/6/2009(UTC)
Posts: 9

That does it. A Semi colon? What does that achieve, after the formula? I mean, besides making it work?
What if I want to multiply this 4 day avg by 2? Would I add a "*2" After the ";"?
Oh, my scaling (don't as me why!) appears on both the left and right sides of the chart. Should I get rid of one side?
And, thanks!
wabbit  
#4 Posted : Wednesday, May 6, 2009 8:29:00 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)
The semicolon signals the end of a line. If you have only one of code it doesn't matter, and its not required on the very last line of code either; the semicolon is only used to separate code from what comes AFTER it.

Armed with that knowledge, if you try to add the "*2" after the semicolon you'll have an error because MS wont know what to do with the partial code "*2". Try:

Code:
2 * mov(H,4,S)


Please have a thorough read of the MS Users Manual as it contains all this good information already; then download the free Equis Formula Primer from the files section and do the exercises contained therein. If you do some simple homework first, by learning how to drive MS, you'll save yourself a lot of frustration and time in the long run.

As for the second price axis :- that's up to you. If you like it, keep it. If you don't like it then remove it.


wabbit [:D]

EFHL62  
#5 Posted : Wednesday, May 6, 2009 11:20:55 PM(UTC)
EFHL62

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/6/2009(UTC)
Posts: 9

Thanks. I've been an on-and-off (mostly off) user of MS since ver 4 and don't recall anything special about a semi-colon. VERY rusty on writing any code now that I've started up again w/ ver 10. Noticed tonite, that clicking Apply then Close vs just the OK box made a difference when editing the formula. Perhaps that was the issue all along. My changes weren't being accepted/changed at all by merely clicking OK. (?).

Thanks again!
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.