In this article we take a global look at creating MultiCharts alerts with code, and briefly discuss the topics we’re going to explore in this chapter. Follow the links to the articles for programming examples and more information.

In this article:

Getting started: working with alerts in MultiCharts

With MultiCharts alerts we can trigger a visual and/or audio notification whenever a condition specified in the code of an indicator or signal is met (MultiCharts Wiki, 2013). That way our script can monitor price action and generate alerts based on predefined signals. While firing alerts based on prices is the most common, we can generate alerts for anything that’s accessible in the code of a PowerLanguage indicator or signal.

But before our script can generate any alert, we’ll have to turn on the ‘Enable Alerts’ checkbox (see image below). When that setting is disabled, our script cannot generate alerts – even when we’ve correctly implemented all of the required code. And so even when we generate alerts programmatically, the manual action of enabling that checkbox is still needed.

Example of the alert configuration settings in MultiCharts

With that option enabled, our indicator or signal can generate an audio alert, notification window, and/or email alert (MultiCharts Wiki, 2013). Besides enabling or disabling alerts, there are also several manual alert settings that include options for specifying when and how the alerts should fire.

For instance, when we set alerts to use a notification window they appear like:

Example of a MultiCharts alert

Usually, an alert notification window fades away after a couple of seconds. An audio alert is even easier to miss when we’re away from the computer. Luckily, we can lookup any alert generated by a script in the ‘Alerts’ tab of the Order and Position Tracker window. An example of that is:

Example of the Order and Position Tracker in MultiCharts

Besides triggering alerts with an indicator or signal, it’s also possible to generate MultiCharts alerts with manual drawings. This has the advantage that we can generate alerts without having to write a script. It has a couple of disadvantages too.

First, we’ll need to configure, enable, disable, and update the drawing’s alert settings by hand; and each of these actions involves multiple steps. Second, the alerts that MultiCharts generates with manual drawings contain little information. This especially becomes a problem when we have multiple drawings on the chart. For instance, here the alert message simply says ‘Trend Line triggered’ for ‘Trend Line #1’:

Example of an alert generated by a manual MultiCharts drawing

Luckily, when we generate alerts programmatically we can create our own, actionable alert messages.

Using code to generate MultiCharts alerts

After we examined those features of working with MultiCharts alerts, the remainder of the chapter explores the different ways to use MultiCharts alerts programmatically. We start those articles with the basics:

To make alert messages more meaningful, we can include dynamic values in them:

Besides how to generate an alert and create a custom alert message, there are a couple of other ways to programmatically work with MultiCharts alerts:

After looking at how to generate and cancel alerts, next we examine how we can prevent many alerts from firing quickly after each other.

Preventing an overwhelming flood of MultiCharts alerts

When our script executes the appropriate PowerLanguage keyword, MultiCharts generates an alert when the script’s manual alert settings are enabled. Sometimes, however, the indicator or signal generates a bunch of alert messages quickly after each other.

Since too many alerts are distracting and as helpful as no alerts, the next part of the chapter discusses ways to limit the number of alerts a script generates:

After discussing ways to limit the number of alerts, we turn our attention to more tips for working with MultiCharts alerts programmatically.

Programming tips for MultiCharts alerts

Those tips and insights to make working with MultiCharts alerts easier are:

  • While we can cancel an alert programmatically and then use code to re-enable it, the first suggestion is not to cancel alerts and turn them back on. That’s because when we generate an alert when a specific condition happens, then cancel it when something else happens, and then re-enable the alert when a different situation occurs, our code becomes unclear, needlessly complicated, and hard to untangle.
  • Another tip are 5 ways to limit the amount of alerts a script generates. That way an indicator or signal doesn’t generate so many alert that they become noise.
  • Alerts can only fire if we enable the alert setting. When our script generates important alerts (like for risk management or trading signals), we can generate an error message when alerts are turned off. This way we know for sure that, when the script runs, its alert option is enabled and it can generate alerts when needed.
  • Because those error messages also turn off the indicator or signal, they can be a bit annoying. An alternative is to create a text box when alerts are disabled. That way we get a clear visual notification that the ‘Enable Alerts’ checkbox is disabled, but without the script halting its calculations.
  • MultiCharts alerts only generate when the indicator or signal calculates, and that calculation usually only happens when there’s a new price update. That means in a slow market with few price updates (like with extended trading hours), alerts can lag (especially if they’re based on time). Similarly, when our instrument is closed, we also cannot generate alerts normally. Luckily, we can address both by recalculating a script periodically. When we do, those time-based calculations can fire alerts independent from price updates.

After these tips and suggestions, next up in the chapter are a couple of ways to use MultiCharts alerts.

Examples of using MultiCharts alerts

A couple of examples of different ways to use MultiCharts alerts include:

After discussing these examples of using MultiCharts alerts, next in the chapter we look at incorporating alerts in trading strategies.

Generating alerts with MultiCharts trading strategies

In the last part of the chapter we look at how we can use alerts with trading strategies. Those approaches include:

  • In generating an alert when automated order execution isn’t enabled we program a signal that fires an alert when automated trading isn’t on by a certain time. Such a notification helps when we auto trade from multiple charts in multiple workspaces and overlooked a chart’s automated trading status before the session begins.
  • When automated trading is enabled, there are several situations that can turn it off (like when there’s a connection loss between MultiCharts and the broker). We can address that by triggering an alert when automated trading gets disabled, which helps to quickly intervene and prevent a small issue from becoming a big problem.
  • Besides alerts for when there’s an automated trading issue, we can also trigger an alert when the strategy’s position changes. With that information we can closely track a strategy’s behaviour in real time without having to monitor its chart, and can quickly jump in when something seems off.
  • Another automated trading risk is a miscommunication between MultiCharts and the broker. When MultiCharts and the broker disagree about the market position, MultiCharts can end up trading a different position than that’s currently open at the broker. This creates different problems, including the strategy not going flat when it should. To help combat that issue, we can generate an alert when the broker’s position doesn’t match MultiCharts’ position.

We end the MultiCharts alerts chapter with a summary of generating MultiCharts alerts, in which we reiterate the most important points.


MultiCharts Wiki (2013, May 10). Using Alerts. Retrieved on January 28, 2017, from

Visit programming tutorials for more helpful coding articles.