Rank: Newbie
Groups ready for retrieval: Registered, Registered Users Joined: 3/19/2009(UTC) Posts: 6
|
Does metastock have a formula I can use to draw a simple line between two price points.
for example:
point one is $52.20 at 3/23/2008 12:20pm
point two is $53.80 at 3/24/2008 4:00pm
is there a formula that will draw a line connecting these two points?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/7/2005(UTC) Posts: 602
|
I am assuming you know about the "trendline" on the toolbar. Right click toolbar and select if you do not. You can write a formula to do so using Valuewhen() and Barssince() but you have to put the line to zero (or somewhere) since it doesn't disappear after your end point.
|
|
|
|
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)
|
Hi ronald, This is easier to code than you might think... The key is to define the two points (the start point and the end point) in terms of price and time (or x and y if your so inclined). There is plenty of information on the forum as to the best ways to work with dates. Once you have these points defined, to connect them, you use an algorithm in MS along the lines of (remembering some high school maths): priceAtTime = StartPrice+BarsSince(StartTime)*lineGradiant where: lineGradient = (EndPrice-StartPrice) / (EndTime-StartTime) i.e rise/run You can get fancy in MetaStock to do all sorts of tricks and error handling, you can draw a smnooth line for the bars when the stock traded or you can create a more jagged looking line for calendar days etc., but for personal use you should be able to come up with something which suits your purpose. You might want to use Jose's previous work as a template, see: http://www.metastocktools.com/MetaStock/2plot.txt
|
|
|
|
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.