Besides organising scripts into folders and customising the window panels we can also change the options of the code editor window itself. Which options are there?

Using and customising the PowerLanguage .NET Editor

The primary tool for creating and editing MultiCharts .NET indicators, strategies, and functions is the PowerLanguage .NET Editor (MultiCharts, 2014). While scripts can also be edited in other programs (like Visual Studio or even Notepad), operations like exporting, importing, and removing scripts is only possible in the PowerLanguage .NET Editor.

And so the PowerLanguage .NET Editor is a program that we’ll often use. Luckily, we can customise it to our preferences by rearranging window panels and organising scripts into folders. And the main editing window, in which we write and edit scripts, can have its font and code highlighting changed. We explore both of these options below.

Changing the Editor options in the PowerLanguage .NET Editor

To change the code editor’s appearance, we need to go to the ‘Tool’ menu and select ‘Editor options’:

Editor Options menu item in the PowerLanguage .NET Editor

That opens the ‘Highlighting Style Editor’ window where several aspects of the code editor can be changed:

Highlighting Style Editor window

With those options set to their default values, the code in the PowerLanguage .NET Editor looks as follows:

Example of default syntax highlighting in the PowerLanguage .NET Editor

Let’s examine how we can change the font and code highlighting options of this code window.

Adjusting the code editor’s font in the PowerLanguage .NET Editor

We change the font of the PowerLanguage .NET Editor’s code editing window with the ‘Font’ pull-down menu in the ‘Highlighting Style Editor’ window:

Font options in the PowerLanguage .NET Editor

All fixed-width fonts are highlighted with bold in that list. These fonts, also known as monospace fonts, have letters and characters that each occupy the same amount of horizontal space (Wikipedia, 2015). Such fonts make programming code easier to read.

Available monospace fonts in the PowerLanguage .NET Editor

Below we look at the fixed-width fonts available in the PowerLanguage .NET Editor. To compare them easily, each image shows the same part of the standard ‘AdvanceDecl_Line’ indicator. By the way, you may have more fixed-width fonts installed on your computer; the following were available on a fresh Windows Server 2012 R2 installation:

BatangChe (15px):

Example of BatangChe font in the PowerLanguage .NET Editor

Consolas (14px):

Example of Consolas font in the PowerLanguage .NET Editor

Courier New (13px):

Example of Courier New font in the PowerLanguage .NET Editor

DFKai-SB (13px):

Example of DFKai-SB font in the PowerLanguage .NET Editor

DotumChe (14px):

Example of DotumChe font in the PowerLanguage .NET Editor

FangSong (14px):

Example of FangSong font in the PowerLanguage .NET Editor

GulimChe (14px):

Example of GulimChe font in the PowerLanguage .NET Editor

GungsuhChe (14px):

Example of GungsuhChe font in the PowerLanguage .NET Editor

KaiTi (14px):

Example of KaiTi font in the PowerLanguage .NET Editor

Lucida Console (13px):

Example of Lucida Console font in the PowerLanguage .NET Editor

MingLiU (14px):

Example of MingLiU font in the PowerLanguage .NET Editor

Miriam Fixed (13px):

Example of Miriam Fixed font in the PowerLanguage .NET Editor

MS Gothic (14px):

Example of MS Gothic font in the PowerLanguage .NET Editor

MS Mincho (14px):

Example of MS Mincho font in the PowerLanguage .NET Editor

NSimSun (14px):

Example of NSimSun font in the PowerLanguage .NET Editor

Rod (13px):

Example of Rod font in the PowerLanguage .NET Editor

SimHei (14px):

Example of SimHei font in the PowerLanguage .NET Editor

Simplified Arabic Fixed (13px):

Example of Simplified Arabic Fixed font in the PowerLanguage .NET Editor

SimSun (14px):

Example of SimSun font in the PowerLanguage .NET Editor

SimSun-ExtB (14px):

Example of SimSun-ExtB font in the PowerLanguage .NET Editor

Changing the code highlighting in the PowerLanguage .NET Editor

Besides changing the font we can also adjust how certain code elements are highlighted in the PowerLanguage .NET Editor. To change the colour of text, keywords, (documentation) comments, strings, or numbers, we first click on the respective item listed below ‘Display items’ followed by selecting a colour with the drop-down menu. For example, here the foreground colour of a string is set to maroon:

Colour options on the PowerLanguage .NET Editor

When the editor’s options in the ‘Highlighting Style Editor’ are set to their defaults (see table further down below), a part of the standard ‘AdvanceDecl_Line’ indicator looks like:

Example of default code highlighting in the PowerLanguage .NET Editor

Several of the code elements have their own colour here: keywords are blue, numbers purple, the quoted string is red, and the standard text is black.

As an example, let’s change the settings in the ‘Highlighting Style Editor’ window to the following:

  • A 12-point Consolas font,
  • The foreground of keywords set to the ‘LightSeaGreen’ web colour and made bold,
  • Strings set to the ‘DarkOrange’ web colour and made italic,
  • And numbers set to the ‘SlateBlue’ web colour.

The same code segment now looks like:

Adjusted code highlighting in the PowerLanguage .NET Editor

While we can change several colours, the background of the code editor window itself cannot be changed (MultiCharts Support, personal communication, July 31, 2015).

Restoring the default settings of the PowerLanguage .NET Editor

The formatting of the editor’s code window can be revert back in two ways. First, we can reset the PowerLanguage .NET Editor, but this will also reset the appearance of the window panels. An alternative is to manually set the options in the ‘Highlighting Style Editor’ back to their default values again. Those default values are:

Option Default setting
Font & size Courier New, 10 points.
Text Foreground: black (web colour), background: automatic. No bold, italic, or underline.
Keyword Foreground: blue (web colour), background: automatic. No bold, italic, or underline.
Comment Foreground: green (web colour), background: automatic. No bold, italic, or underline.
Documentation comment Foreground: gray (web colour), background: automatic. No bold, italic, or underline.
String Foreground: maroon (web colour), background: automatic. No bold, italic, or underline.
Number Foreground: purple (web colour), background: automatic. No bold, italic, or underline.

See customising the window panel layout and organising scripts into folders for other ways in which we can change the look of the PowerLanguage .NET Editor. In resetting the PowerLanguage .NET Editor we discuss how to revert this editor back to its initial state.

Summary

The ‘Highlighting Style Editor’ window contains options for changing the code’s appearance in the PowerLanguage .NET Editor. Displaying the code in a fixed-width font (which has characters that all have the same width) makes programming code easier to read and skim through. We can also change the formatting of individual code elements in this window, but the background colour of the PowerLanguage .NET Editor’s main window cannot be changed.


References

MultiCharts (2014). MultiCharts .NET Programming Guide (version 1.1). Retrieved from http://www.multicharts.com/downloads/MultiCharts.NET-ProgrammingGuide-v1.1.pdf

Wikipedia (2015, July 17). Monospaced font. Retrieved on Augustus 1, 2015, from https://en.wikipedia.org/wiki/Monospaced_font