Blog

Trendline Issues

by Bill Brower on May 22, 2016 | Categories: Uncategorized |

Trendline Issues

Drawing trend lines on a chart has always been a significant body of work for technical traders. Since very early on, TradeStation came equipped with drawing tools that made it easy to manually apply trend lines to charts as well as to create them automatically from the code of an indicator or other analysis technique. Applying them manually to a chart gives you the freedom to apply them to price bars or even indicators in a subgraph. This is commonly done to show the occurrence of divergence. However, this becomes a problem to do mechanically from the code in an analysis technique because trend lines are assumed to be plotted on price bars in Data1. An exception to this is the feature of OOEL to allow trend lines to be plotted on price bars in Data2 or other data series. However, that is still not the same thing as applying a trend line to an indicator in subgraph 2.

Classical Easylanguage trend line tools are quite capable of properly and easily adding trend lines to charts of minute, daily, weekly or monthly based data. However, they do not work so well on tick or volume charts because the start and end points of the trend lines are specified using the date and time of the bars. Tick charts often have multiple bars with the same date and time stamp and so the trend line always is connected to the first bar with that same date and time. Remember, we are talking about trend lines created by code not manually drawn. There is no way to get the trend line to choose one of the other bars with the same date and time using classical Easylanguage on tick charts. However, with OOEL, there is a class of drawing tools devoted to trend lines making it possible to select the start and end points of the trend line by referring to the bar number. This is done using the BNPoint class.

There is one little catch though when using the BNPoint class to specify the start and end points of the trend lines. That is the fact that the bars on the chart are given different bar numbers than that returned by the “currentbar” or “barnumber” commands. The BNPoint class counts all the bars in the “maxbarsback” window and any missing bars as well. Missing bars on a daily chart would be a holiday for instance. On a minute based chart, they could simply be bars where no trades took place but could have or bars that don’t exist because the market closed early before a holiday. Counting those missing bars can be difficult. The good news is that on tick or volume bars, there never are any missing bars because they do not occur on any fixed time based schedule. This means the OOEL trend line drawing object class will work just fine if you identify your endpoints using the BNClass. However, you cannot use those tools for time based charts because of the missing bars problem. The solution is to use conventional trend line Easylanguage for time based charts and OOEL tools for tick and volume based charts. You can use the “Bartype” command to identify the type of bar on the chart and switch to the appropriate toolset automatically.

Share