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