Extendable Line Drawingtool

This script was written with the idea of speeding up the process of drawing lines during my day trading.

This drawing tool can do pretty much everything directly from the context menu now. The only thing it cannot do is set/unset drawing to global. Feature request SFT-948 is already in place for this.

I am not a programmer by trade, I am still in the early stages of learning, so even though it has been working fine for me, this script may have bugs and/or inefficiencies.

I basically took the existing Line DrawingTool code, changed it as needed, then added more code as needed.

Feel free to update, improve, fix, or just make more efficient any part of the code as you see fit, all I ask is that you share it on the NinjaTrader support forum.

[*]This is a full fledged drawing tool which allows you to draw a line then optionally extend/contract the start and/or end point(s) of the line.
[*]You can give it a custom hotkey via the hotkey manager in the tools menu of the control center window.
[*]Quicker and easier way to duplicate a line via the context menu of the line (right-click menu)
[*]You can add this line type into your own code just like any other built-in DrawingTool via Draw.ExtendableLine() with multiple overloads.
[*]Context menu will include the line's tag with the line's color as the background color of the text.
[*]can be extended/contracted via context menu and/or the drawing objects window.
[*]you can use NT's built-in alert system with this line type.
[*]Set line as horizontal
[*]Set line as vertical
[*]Quick access to templates
[*]Save templates quicker than you normally would be able to.
[*]Change line dash style, color, width directly from context menu
[*]view/hide start/end point info directly on the chart

UPDATES:
Aug 24, 2017 - a couple minor updates to the UI
Jan 22, 2018 - added options to set line as vertical or horizontal based on either the start or the end point, thank you to RonnyKeller for adding the code to set the line as horizontal

Jan 23, 2018 - Issue fixed : Set as vertical at end point now works, coding error caught by Jim from the NT support team.

Jan 27, 2018 - minor bug fixes, updated the menu layout, added "Templates" menu

Feb 15, 2018 - The line now works correctly when set as global using a work-around. Added a way to save a template quickly right into the context menu. Due to cleaning up some code inefficiencies, the line should work more smoothly now. Added a check mark to follow which template was last loaded. I have moved the "Duplicate" menu item back to the top.

Mar 26, 2018 - Added the options to change line color, line dash style, and line width directly from the context menu itself. Also made a minor bug fix.

May 07, 2018 - Added the option to view start and end point info directly on the chart. The text will automatically move to stay out of the line's way. Also, the "Duplicate" option has been moved back down to group it with "Copy" and "Remove".

May 09, 2018 - AutoScale can now be toggled directly from the context menu. A place holder for toggling global drawing is set in place and just waiting for update(s) for feature request SFT-948.

July 25, 2018 - I have customized the line dash styles so that they are easier to see. This is specific to only the ExtendableLine drawing tool and will not make any changes to anything else.

Sscreenshots: (requires you to be logged in)
https://ninjatrader.com/support/forum/attachment.php?attachmentid=49761&d=1532574039

If you used a version of this script prior to the Feb 15th update, please resave all of your templates as the template file format has changed

Known Issues:
[*]When line is set as global, any subsequent changes to the line are not reflected globally as expected, this is due to limitations set in NT8. Feature request #SFT-2479 was created on Sep 26, 2017 to address this.

I've introduced a work-around for this issue in the Feb 15th update. Please note that this is only a work-around while we wait for a real solution to present itself.

Created By gubbar924
NinjaTrader Version 8
File Size 7.4 KB
Create Date 08/23/2017
# of Downloads 799

Importing to NinjaTrader 8 is Easy!

To import your 3rd party app or add-on to NinjaTrader, simply follow these 3 steps:

  1. Download the app or add-on file to your desktop
  2. From the NinjaTrader Control Center window, select the menu Tools > Import > NinjaScript Add-On…
  3. Select the downloaded file from your desktop

Questions?

Visit the NinjaScript File Sharing discussion in the NinjaTrader user forum to interact with fellow traders and the NinjaTrader support team.