Friday, 11 November 2016

Add Button to Chart Toolbar - NinjaTrader 8

NinjaTrader Educational Resourses details an Indicator / script that adds a button with a background image to the toolbar of the chart window. These buttons can be useful to trigger custom blocks of code in NinjaTrader 8 Indicators and Strategies.

The original script can be found on the NinjaTrader 8 Support Forum
using_bitmapimage_objects_with_buttons.htm

demoToolBarButton.cs 
For demonstration, this NinjaTrader 8 Indicator loads a button (but excludes the bitmap) and assigns a Click event. This event simply toggles the printing of the Instrument Name and Description on to the chart.

This is a convenient solution to add custom button functionality to a NinjaTrader 8 Chart. (without the need to impliment WPF)



NinjaTrader 8 - Demo Tool Bar Button
Download the NinjaScript code 
demoToolBarButton.cs





Friday, 4 November 2016

Display Chart Instrument/Symbol Name in Large Letters - NinjaTrader 8

Append this NinjaScript Draw.TextFixed function to the code block:




Instrument Name Label. 6S (Swiss Franc Futures) 



Adjust the font, size, colors and alignment parameters as required. Use this line of NinjaScript code in any NinjaTrader 8 Indicator or Strategy.

NinjaScript > Language Reference > Common > Drawing
Draw.TextFixed : https://ninjatrader.com/support/helpGuides/nt8/en-us/?draw_textfixed.htm


Instrument.MasterInstrument.Name returns the Instrument Name 6S property as shown above

There are a number of other properties in the namespace Instrument.MasterInstrument including:
Instrument.MasterInstrument.Currency, Description and InstrumentType.

NinjaScript > Language Reference ...
Instrument.MasterInstrument : https://ninjatrader.com/support/helpGuides/nt8/en-us/?masterinstrument.htm