Rank: Newbie
Groups: Registered, Registered Users Joined: 5/1/2006(UTC) Posts: 5
|
I'm evaluating various trading platforms. An important feature I need is the ability to draw trendlines on charts.
I did some forum searching and couldn't figure out how this might be done. Perhaps someone could point me to a link?
Also, is there a limit on how many trendlines can be drawn on a chart?
Thanks.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/28/2005(UTC) Posts: 276 Location: Salt Lake City, UT
|
Basically, you just select the type of trendline you want to draw and use your mouse to draw it.
I'm not sure of any limit.
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 5/1/2006(UTC) Posts: 5
|
Branden Russell wrote:Basically, you just select the type of trendline you want to draw and use your mouse to draw it.
I'm not sure of any limit.
Great.
Is it possible to draw trendlines programmatically?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/28/2005(UTC) Posts: 276 Location: Salt Lake City, UT
|
aspTrader wrote:Great.
Is it possible to draw trendlines programmatically?
Unfortunately, no.
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 5/1/2006(UTC) Posts: 5
|
Branden Russell wrote:aspTrader wrote:Great.
Is it possible to draw trendlines programmatically?
Unfortunately, no.
I'm working on a 3rd party add-on for other trading platforms running a common DLL logic codebase and we've had a user request that the add-on run on Metastock. Hence, my questions...
Ok. I suppose a trendline value for each bar could be calculated within a DLL and passed back to be plotted. But I'm interested in plotting dozens or a couple hundred trendlines at certain times which would mean a lot of values plotted.
Possible?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 5/1/2006(UTC) Posts: 5
|
Ok. I understand how I could use functions like these to plot trendlines.
But calculations determining trendline start and end points are in a DLL. The data for the trend lines is passed to the trading platform(s) in a file.
Does Metastock provide some means for reading csv files and parsing the data in csv files?
Thanks in advance for this assistance
|
|
|
|
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)
|
You could get the .dll to read the data from the .csv file, align itself with the chart data and have it draw on the chart... It seems the hard way to do it though?
MS will send the Date and OHLCV etc data to the .dll call and return a single data array. All you need to do is accept the data, use your exisiting logic code to identify the start and end points of the trendline, compute the values of each point along the line and pass these back to MS to draw on the chart. Every bar on the chart will get a return from the .dll computations, so you define the firstValid and lastValid returns to restrict the drawn trendline to the periods of its validity.
But... as I said, you can only return one line from each call to the external function.
wabbit :D
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 5/1/2006(UTC) Posts: 5
|
wabbit wrote:You could get the .dll to read the data from the .csv file, align itself with the chart data and have it draw on the chart... It seems the hard way to do it though?
MS will send the Date and OHLCV etc data to the .dll call and return a single data array. All you need to do is accept the data, use your exisiting logic code to identify the start and end points of the trendline, compute the values of each point along the line and pass these back to MS to draw on the chart. Every bar on the chart will get a return from the .dll computations, so you define the firstValid and lastValid returns to restrict the drawn trendline to the periods of its validity.
But... as I said, you can only return one line from each call to the external function.
wabbit :D
Thanks wabbit,
What you've described makes sense. I just have a few questions about how this might work.
1 I pass necessary data (date/time and OHLC) to the DLL.
2 DLL does all necessary calculations of trend line values bar by bar. (I understand the start and end points issue.)
3 I don't need to pass this data back to MS through a file. I can use a data array.
So far so good. But you also say that I can only plot one trendline per external function call.
If I had a scheme for encoding the values of multiple trendlines within that array, is there any way I could plot multiple trendline values?
Thanks.
|
|
|
|
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)
|
Not that I am aware of. Working from within MS you can, but we mere-mortals can only work externally!
You would just have to call the external function for each trendline e.g
ExtFml("trendline.up1", Data Array);
ExtFml("trendline.up2", Data Array);
ExtFml("trendline.up3", Data Array);
ExtFml("trendline.dn1", Data Array);
ExtFml("trendline.dn2", Data Array);
ExtFml("trendline.dn3", Data Array);
etc
wabbit :D
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 5/17/2005(UTC) Posts: 24 Location: London
|
aspTrader wrote:
What you've described makes sense. I just have a few questions about how this might work.
1 I pass necessary data (date/time and OHLC) to the DLL.
2 DLL does all necessary calculations of trend line values bar by bar. (I understand the start and end points issue.)
3 I don't need to pass this data back to MS through a file. I can use a data array.
So far so good. But you also say that I can only plot one trendline per external function call.
If I had a scheme for encoding the values of multiple trendlines within that array, is there any way I could plot multiple trendline values?
Thanks.
Hi asp
I thought I'd reply to your post since I have built a dll for trendlines. Wabbit is right in that only one trendline can be passed to Metastock from the dll at a time. The problem is that the MSX DLL has only one data array which is passed to Metastock. Its not possible to modify the data array in the manner I think you want (E.g. create an array of arrays, DataArray[NoOfTrendLines][Time]).
However an MSX DLL can have up to 9 input parameters. What you can do is use one of those parameters to tell the DLL which trendline to return. e.g. ExtFml("TrendLineFunc", 1) which return trendline number 1; ExtFml("TrendLineFunc", 2) which returns trendline no.2, etc.
Also don't underestimate your point no.2. Formulating objective mathematical rules for trendline construction is a very very tricky process (Its taken me 8 months to get my program to produce replicas of lines which I would draw by freehand) however it is possible. You'll probably find that on the first few gos, your rules will not be specific enough and the program will draw lines in all manner of places but keep going!
Regards
Craig
|
|
|
|
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.