Besides all the manual MultiCharts options there are some script features that can only be enabled programmatically. What are these so-called ‘attributes’ and which script behaviour do they affect?

In this article:

What are PowerLanguage attributes?

While practically all settings in MultiCharts can be configured manually, there are a few features that can only be set with programming code. We enable or disable those settings with PowerLanguage keywords that are called attributes.

These attributes are applied to a script during compilation and cannot be changed during run-time (e.g., MultiCharts Wiki, 2014). This simply means the following: once we’ve set an attribute in our code, we cannot change the behaviour that’s affected by that attribute unless we change the attribute’s setting and recompile the script.

An attribute can be placed anywhere in the code, but their typical location is in the top of the script (TradeStation, 2007). For example:

Example location of MultiCharts attributes in a script

Attributes only affect the script in which they’re used (TradeStation, 2007) – other scripts on the same (or a different) chart are unaffected by these attributes.

We can classify MultiCharts attributes in two groups: those that we can use any script and attributes that are exclusively for signals (that is, strategy scripts). Let’s take a quick look at both groups.

MultiCharts attributes for indicators, strategies, and functions

The PowerLanguage attributes that can be used in both indicators and strategies are:

  • The ProcessMouseEvents attribute, which enables (or disables) mouse click processing in a MultiCharts script. This attribute allows us to create semi-automatic scripts that not only process price data but also our mouse clicks.
  • With the RecoverDrawings attribute we prevent MultiCharts from removing our intra-bar generated drawings automatically. That prevents the odd behaviour whereby a programmatically made arrow, text box, or trend line automatically disappears within a second or so of being created.
  • And the LegacyColorValue attribute makes it possible for our script to work with the legacy colour scheme that allowed for just 16 different colours. While this attribute is helpful when importing old scripts, it’s the rarest attribute there is.

MultiCharts PowerLanguage attributes for trading strategies

In the second half of this PowerLanguage attributes chapter we look at the three attributes that are designed specifically for signals:

  • The AllowSendOrdersAlways attribute makes it possible for a signal to submit its orders regardless of the script’s calculation reason. This makes it, for example, possible to submit orders when the second data series is processed or whenever a time-based recalculation happens with the price bar closed.
  • With the IntrabarOrderGeneration attribute we enable or disable a signal’s intra-bar order generation. With that feature MultiCharts can submit orders when a price bar hasn’t closed yet, and this can make the strategy respond to price changes while the price bar still develops.
  • Last but not least, the SameExitFromOneEntryOnce attribute makes it possible for our script to reuse exit orders. This is a big help when scaling out of the same position repeatedly since it saves us from having to code each exit order separately.

We end this chapter with a summary of PowerLanguage attributes in which we repeat the most important points.


References

TradeStation (2007). EasyLanguage Essentials: Programmers Guide. Retrieved on November 26, 2015, from https://www.tradestation.com/~/media/Files/TradeStation/Education/University/School%20of%20EasyLanguage/Books/EL_Essentials.ashx

MultiCharts Wiki (2014, January 23). RecoverDrawings. Retrieved on February 8, 2016, from http://www.multicharts.com/trading-software/index.php/RecoverDrawings