Mouse clicks can be used to influence programming code execution. But how can we manipulate the chart window with mouse clicks?

In this article:

Mouse clicks and the Command Line in PowerLanguage

Mouse clicks are processable when ProcessMouseEvents is set to true (MultiCharts Wiki, 2012). Each click on a data series’ chart area then triggers a script calculation so that the mouse click keywords reflect the current click info. These include MouseClickCtrlPressed and MouseClickShiftPressed for indicating whether the Control or Shift keys were pressed during the click.

Changing a MultiCharts price chart is possible with the Command Line. This toolbar manipulates the active chart through textual commands (MultiCharts Wiki, 2014). It looks like:

The Command Line toolbar in MultiCharts

Instead of manually typing in these commands, they can also be executed programmatically with the CommandLine() keyword (MultiCharts Wiki, 2013). Keep in mind though that each time when CommandLine() is executed, its Command Line command is also carried out. This can lead to a continuously changing price chart until the script is manually aborted.

Reloading price data with mouse clicks and the Command Line

One Command Line feature is reloading price data on the current chart. This can be triggered by mouse clicks as follows:

[ProcessMouseEvents = true];

if (MouseClickShiftPressed) then 
    CommandLine(".rld int=1 day")
else if (MouseClickCtrlPressed) then 
    CommandLine(".rld int=2 weeks, res=30 min");

First we set ProcessMouseEvents to true. Then an if-else statement checks whether the Control (MouseClickCtrlPressed) or Shift (MouseClickShiftPressed) keyboard keys were pressed down during the click.

When Control is used with a click, CommandLine() is executed with the .rld command. This command reloads price data on the active chart and potentially on other charts with the same symbol (MultiCharts Wiki, 2014). It’s used here together with the int parameter, which specifies the time period that needs to be reloaded. Given the int value of 1 day, one day of price data is reloaded for each of the chart’s data series with a mouse click plus Shift.

CommandLine() is also executed when Shift was held down during the click. The command then also reloads price data (.rld), but now for two weeks back (int=2 weeks). With the res=30 min parameter this reload will only apply to 30 minute data series on the chart.

Adding indicators to the chart programmatically

The Command Line can also add indicators to the chart. If we start with a price chart like the following:

MultiCharts chart before executing the PowerLanguage code

Executing the code (see below) leads to:

MultiCharts chart after executing the PowerLanguage code

This is done with the following code:

[ProcessMouseEvents = true];

if (MouseClickShiftPressed and MouseClickCtrlPressed) then begin

    CommandLine(".iind name=Volume");
    CommandLine(".iind name=Mov Avg Exp 2 Lines");


After mouse click processing is enabled by ProcessMouseEvents, an if statement evaluates whether both Control and Shift were pressed down during the click. When they were, the code inside the if statement is executed.

That code consists out of two CommandLine() statements that both use the .iind command. This command adds the indicator specified by its name parameter to the current chart (MultiCharts Wiki, 2014). The first .iind command adds the ‘Volume’ indicator, while the second adds the ‘Mov Avg Exp 2 Lines’ indicator to the chart.


Once ProcessMouseEvents is enabled, mouse clicks can be used to execute Command Line commands through the CommandLine() keyword. Available commands include .rld (reloads price data) and .iind (adds an indicator to the chart).


MultiCharts Wiki (2012, February 24). ProcessMouseEvents. Retrieved on January 11, 2015, from

MultiCharts Wiki (2013, May 16). CommandLine. Retrieved on January 18, 2015, from

MultiCharts Wiki (2014, August 18). MultiCharts Work Area: Understanding Command Line. Retrieved on January 18, 2015, from