While MultiCharts PowerLanguage scripts can do a lot programmatically, sometimes a manual action is still needed or desired (like drawing an arrow to highlight a price bar). With mouse clicks we can programmatically process these actions so that the indicator or strategy can use this information during run-time.

In this article:

Working with mouse clicks in PowerLanguage

Mouse clicks can only be processed by an indicator or trading strategy after the ProcessMouseEvents attribute is set to true (MultiCharts Wiki, 2012).

With that attribute enabled, each click on the chart triggers a script calculation – similar to how incoming ticks are processed in real-time. With that process the different mouse click keywords are updated and available with the click’s data.

Mouse clicks, however, are only processed by PowerLanguage when they occur on a data series’ chart area – clicks on an indicator’s subchart aren’t registered. And while both mouse buttons are recognised, the right button still brings up the right-click menu, making it not useful for working with mouse clicks.

The mouse click keywords in MultiCharts PowerLanguage

The mouse click articles start with discussing the keywords that return click data:

Mouse clicks and their PowerLanguage calculation reasons

With ProcessMouseEvents enabled, each click triggers a calculation that provides extra click information:

Combining mouse clicks with other PowerLanguage keywords

Mouse clicks can be combined with other PowerLanguage features, such as:

Working with the mouse click location in PowerLanguage

Because the mouse click keywords return both the price level and date and time value of a click’s location, these can be used to determine where a click took place:

Using mouse clicks to draw objects in PowerLanguage

We can use a mouse click’s location also to draw objects on the chart, like:

Combining mouse clicks with orders in trading strategies

Mouse clicks can also be processed by signals, and thus orders can be submitted with mouse clicks:

The mouse clicks chapter concludes with a summary of mouse clicks.


References

MultiCharts Wiki (2012, February 24). ProcessMouseEvents. Retrieved on January 11, 2015, from http://www.multicharts.com/trading-software/index.php/ProcessMouseEvents