[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trend Line syntax



PureBytes Links

Trading Reference Links

Wayne,

I'm copying this to the omega-list because it highlights what
appears to be a bug in TradeStation's data window, and possibly also
in TL_GetValue.

(Wouldn't you know, after getting hundreds of spams from comcast.net
and finally setting up a spam filter to forward all such mail to
spamcop, I see a legitimate mail from you in my spamcop reporting
queue.  I think I've adjusted things so that authenticated comcast
senders will get through.)

Anyway, I think I misunderstood me when I wrote:

>You can do that, but if you calculate your own trendlines,
>make sure you do it on log(price) instead of price.  Usually
>tradestation displays price charts in log scale (as it should),
>which means that the trendlines, slopes, and extensions are
>actually being calculated on log prices.  Any new price read off
>the trendline is actually the ExpValue of the internal trendline
>value.

What I meant here is that when TS draws trendlines on a log-scale
price chart, the only way it can do so and be able to read prices
off the trendline, is to calculate the trendline internally using
log prices, and then convert them to non-long prices for display.

Looked at another way, if you have a log-scale price chart, and you
tried to draw every point on a trendline (not just connect a line
between two points, but actually draw a point on the trendline at
every bar) you have to perform your trendline calculations on log
prices.  If you didn't, and you tried to plot the points on your
trendline, you would get a curved line on the price chart instead of
a straight line.

You wrote:
>I do not think your statements above are correct. If a TL_New(...)
>is plotted on a log scale, the points defining the starting and
>ending points of the TL are not related to the log or expvalue of
>any price number.

If all you cared about was the start and end points of the TL, it
wouldn't matter.  However, TS can also show you the values of any
arbitrary point on a trendline.  All the points in between the
starting and ending points of the TL, and all the points on the TL
extended to the right of the end point, cannot be determined any
other way than to calculate the trendline on log prices and then
convert the values back to linear prices.

I'll illustrate the point with a monthly soybean chart, which has
a high of about 2400 and a low of about 350, since 1980.  The
chart is in log scale.  If I draw a trendline between the high
and low (H=2411.74, L=351.42), where do you suppose the middle
of the trendline is?  Halfway between those prices?  That would
be (351.42+2411.74)/2 = 1381.58.  Wrong.  I'm looking at it now.

Interestingly, when I put the cursor on the center of the trendline,
the data window shows 1351.58, which is incorrect; it's obviously
nowhere near that on the price scale.  It falls between the 800 and
1000 price grid lines.  Holding down the left mouse button on the
midpoint, a price of about 918 pops up.

The only way one can get a price of 918 from the midpoint of this
trendline is to calculate it in log scale.  If you calculate (log
351.42 + log 2411.74)/2 you get 6.825, and converting that to
linear, exp(6.825) = 920 --- very close to where my cursor is
showing.

Because the data window display is obviously incorrect, it is
possible that reading values off a trendline within EasyLanguage
will also be incorrect.  I haven't tested that.  If it's wrong, then
the best thing is to calculate trenline values yourself, using your
start and end points in log scale.

-Alex