Custom Drawing Tools
Build Custom Drawing Tools
Custom Drawing Tools allow us to easily create and share custom user-defined drawing tools for use in the Trader application. Defining a custom drawing tool is very similar to defining a custom indicator. We need to create an object that obeys the DrawingToolImplementation interface, as well as export an object that obeys the DrawingTool interface. Let’s look at each:
We can see from this example how to define a Custom Drawing Tool at the module.exports level - we need at least the name and drawing fields. The most important field is the drawing. This is where we define our DrawingToolImplementation methods. Let’s explore those methods now.’
You can see that each of these functions controls some aspect of the tool. Let’s do something simple and draw a line between two points using the render function.
Now if we choose ‘My Line’ from the drawing tools selector, we should be able to draw a line between two points.
![A line from point anchors[0] to point anchors[1]](https://tradovate.github.io/custom-indicators/media/DrawingTools1.png)
This is a very simple line drawing tool. Let’s take it a step further and add a tooltip. When viewing a Drawing Tool that you’ve drawn onto a chart, you may mouse over it holding the SHIFT key to reveal its tooltip. If you don’t define tooltip behavior, nothing will happen. Let’s make a tooltip that renders some text and a special delta object.
When we hold SHIFT over our drawing now, it will display ‘My Line’ and the tick delta information between the two points anchors[0] and anchors[1]. Try moving it around to see how it changes.


