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

Notification

Icon
Error

Options
Go to last post Go to first unread
Leverage  
#1 Posted : Tuesday, June 7, 2011 7:32:26 AM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

Hi guy... I trying to plot the average price about load data. For example something like: ind:=(Highest(C)+Lowest(C))/2; ind but the line plotted for the load data it's not costant, but variable for each bar who form a new relative max. Someone have an idea to obtain a costant value to plot in base of the max and the min for the load data? Thanks
jjstein  
#2 Posted : Tuesday, June 7, 2011 11:53:33 AM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Do you want the "average" price for one bar, or over time?

Metastock Formula Language can be a little confusing, until you recognize that the price variables of H, L, O, C (High, Low, Open, Close) is treated as an "array" -- a collection or group of numbers spread over a time. The time PERIODICITY is specified in the lower-right toolbar: D=Daily, W=Weekly, etc -- each bar can represent a Day, a Week, etc.

In the example you gave, "Highest(C)" would give the largest value for closing price over the entire time period you loaded (something specified in LOAD OPTIONS when using FILE OPEN). It is important to note that this is different vary from the period loaded for Explorations and System Tests -- if they're not the same, the results can be different from what you see on a chart!

For any given bar, you can use these built-in functions (details are in F1 - HELP):

Median Price, or MP(), which is (High + Low)/2
Typical Price, or TYP(), which is (High + Low + Close)/3

Leverage  
#3 Posted : Tuesday, June 7, 2011 12:24:46 PM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

Thanks JJ my interesting is for over time not one bar. For example if I load 500 bar, I would like to plot the average price through the highest close (or high) of this 500 bars and the lowest close (or low) of this 500 bars. Thus, if I load 1000 bars i would like to plot the average price of this 1000 bars etc...
jjstein  
#4 Posted : Tuesday, June 7, 2011 12:57:24 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Try this:

{* Long-Term Average *}
Periods:=Input("Periods",1,10000,500);
(HHV(C,Periods)+LLV(C,Periods))/2


Leverage  
#5 Posted : Wednesday, June 8, 2011 4:39:36 AM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

Thanks JJ, it's a good point to start....I try to reason from this. thanks again
wabbit  
#6 Posted : Thursday, June 9, 2011 8:52:58 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)
Do you mean the average of all the prices of the loaded data, or, the midpoint between the highest and lowest data points? They are not the same...

Use LastValue() to make a constant of the data across the entire chart, but be warned the information cannot be used for real life trading without being fully aware of how it works!


wabbit [:D]

Users browsing this topic
Guest (Hidden)
Similar Topics
average price (Formula Assistance)
by wens5168 4/1/2013 1:25:21 AM(UTC)
Looking for % of NYSE Comp stocks above 200 day moving average price line (Data Related Questions)
by Shelby 3/4/2013 12:34:31 PM(UTC)
HELP How to code: "If 5-day average price > 5-day average price from the prior 5-day period" (Formula Assistance)
by meridien 7/6/2009 2:27:50 PM(UTC)
How do I generate a conditional clear signal for an average price? (Formula Assistance)
by BillyB 3/14/2007 12:21:34 PM(UTC)
How do I generate a conditional clear signal for an average price? (MetaStock)
by BillyB 12/14/2006 1:08:57 PM(UTC)
VWAP - Volume Weighted Average Price [RESOLVED] (Formula Assistance)
by axioma 10/15/2005 1:04:25 PM(UTC)
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.