Skip to content

Tutorial 185 | Changing the TradeStation DataTip when hovering over drawing objects

Tutorial185-1

Tutorial 185 is built around a TradeStation EasyLanguage PaintBar study (_Tutorial185-Paintbar) that analyzes a chart searching for rectangles that have been drawn by the user using the chart drawing tools. The program modifes the datatips dialog to add the values of the number of bars in the rectangle and the price difference between the upper price and lower prices in the rectangle. These values are only displayed when hovering over bars that are encompassed by the rectangle. The same techniques could be modified and used with other drawing objects to display other values.

The paintbar study includes a method called PlotVals( ). This method goes through the rectangles on the chart and extracts the information that needs to be plotted. It stores it in Appstorage with the key values being the number of each bar within the rectangle being analyzed. The method then throws and exception which causes the program and the data to be reloaded. The method runs when a rectangle drawing object is created or clicked. The method uses another method: DTtoBN, to convert Datetime values to Barnumber.

In this program the exception is thrown using a macro called using Runcommand. This requires that the ‘Enable runcommand EasyLanguage keyword…’ check box is selected in the format-analysis dialog box. See quicktip 53 for information about using RunCommand and this macro.

For every bar on the chart the program checks to see whether there is a value stored in AppStorage for that bar, if so the number of bars in the rectangle and the price difference between the top and bottom of the rectangle are parsed using a TokenList and then plotted.

Appstorage

AppStorage is a Dictionary of name-value pairs that is persistent when an analysis technique is re-verified, has its inputs modified, or re-runs for another reason (such as when it is disabled by the user temporarily, and then enabled again). This means that when the exception is thrown the values persist in the Appstorage and can be plotted.

Values that are stored in AppStorage are saved when the workspace is saved.

More information can be found about Appstorage in tutorial 119.

Technical lessons

Tutorial 185 provides information about using the ChartingHost provider to detect the creation of a new drawing object or a drawing object being clicked. The tutorial program uses Vectors extensively as well as AppStorage (a dictionary) and Token list. A method is demonstrated to find the equivalent bar number for a datetime. The tutorial also demonstrates how to force a reload and how to detect the first tick of a new bar.
Link
When hovering over a bar that is included in a rectangle
When hovering over a bar that is included in a rectangle
Link
When hovering over a bar that is not encompassed by a rectangle
When hovering over a bar that is not encompassed by a rectangle

In order to use Tutorial 185, “Enable Runcommand EasyLanguage keyword” must be clicked (as in the following screen shot). The user can decide whether confirmation is required or not. 

Link
Enable Runcommand EasyLanguage keyword
Enable Runcommand EasyLanguage keyword

Video explaining tutorial 185

Hopefully you can understand this tutorial and replicate it for your own use and education. If you want to save some time typing in the code then the Tutorial 185 Paintbar study available for  IMMEDIATE download for $39.95  by clicking the following ‘add to cart’ button. 

The tutorial program is not compatible with MultiCharts.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.