This articles summarises the most important points of the previous MultiCharts .NET Command Line articles. Follow the article links for examples and more information.

Working with the MultiCharts .NET Command Line

The Command Line manipulates the active chart window with textual commands (see MultiCharts Wiki, 2014). It looks like:

Example of the MultiCharts .NET Command Line toolbar

Instead of typing in these commands manually, they can also be executed programmatically with the ChartCommands.CommandLine() method (PowerLanguage .NET Help, n.d.).

Every time ChartCommands.CommandLine() is called, its command is executed. By calling this method conditionally, such as depending on a Boolean variable, it can be prevented that the command unintentionally executes more than once.

Since ChartCommands.CommandLine() is an asynchronous method, the current thread might need to be paused for a small amount of time to give it time to perform its tasks. See working with the asynchronous Command Line method for more.

Adjusting the visual appearance of a chart with the Command Line

The bar spacing of a chart can be changed with .bsi (increases bar spacing) and .bsd, which decreases it (MultiCharts Wiki, 2014). Both adjust the bar spacing with one step each time they’re executed, and the size of this step depends on the current bar spacing.

These commands are executed as follows:

ChartCommands.CommandLine(".bsi");
ChartCommands.CommandLine(".bsd");

The .eds command displays the entire data series (MultiCharts Wiki, 2014). This is done by decreasing the bar spacing such that all price bars from all data series are in the chart view.

.eds is executed as follows:

ChartCommands.CommandLine(".eds");

Changing the chart symbol with the Command Line

The .csy command changes a chart symbol (MultiCharts Wiki, 2014). Its basic usage looks like:

ChartCommands.CommandLine(".csy name=GBP/USD");

The .csy command has the following parameters (MultiCharts Wiki, 2014):

Parameter(s) Description Example
name Sets the symbol to change to (case sensitive). name=EUR/USD creates an EUR/USD chart, while name=@EU# switches the symbol to IQFeed’s continuous 6E future.
df Specifies the symbol’s data feed. Needs to match exactly. name=EUR/USD, df=MB Trading specifies that the EUR/USD symbol from MB Trading should be plotted. Note that df=MB trading (wrong capitalisation) and df=MB Trading (two spaces) don’t work.
desc Specifies the description of the symbol to load (case sensitive). desc=EURO STOXX 50: changes the chart to the EuroStoxx 50 future.
res Sets the resolution of the symbol. See changing the chart resolution with the Command Line for an overview of possible values. When this parameter is missing, the resolution of the existing data series on the chart is used. res=15min: plots the symbol as a 15 minute chart.
from, to Set the data range. The required date format depends on your Windows settings and is either DD/MM/YYYY or MM/DD/YYYY (Andrew MultiCharts, 2014). When these parameters aren’t set, the data range of the existing data series on the chart is used. For more, see changing the data range programmatically. from=1/5/2012, to=9/10/2014: plot the symbol from May 1, 2012, to October 9, 2014, when one’s operating system is set to Western European settings.
dnum Specifies the data number. When omitted, defaults to the selected data series; with no data series selected it applies to the first data series. dnum=2: makes the .csy command apply to the second data series.
bfm Specifies whether a daily-based chart (day, week, month, quarter, or year time frame) needs to be based on minute (bfm=1) or daily (bfm=0) data. When bfm is missing, daily-based charts are made with daily data. res=1day, bfm=1: creates a daily chart constructed from minute data.
mute Prevents the ‘Format Instrument’ window from displaying when there is an error in the .csy command (by default, this window is shown). name=ER/DSU, mute: switches to the non-existing ER/DSU symbol, but won’t show the ‘Format Instrument’ window with this faulty request.
, Multiple .csy parameters are separated with comma’s. .csy name=EUR/USD, res=15min.

The .csy command can be used for multiple purposes:

By verifying if a symbol exists in the QuoteManager database we can prevent faulty .csy or .isy commands.

Adding a symbol to the chart with the Command Line

The .isy commands adds a symbol to the chart (MultiCharts Wiki, 2014). Basically, it looks as follows:

ChartCommands.CommandLine(".isy name=@ES#");

.isy has the following parameters (MultiCharts Wiki, 2014);

Parameter(s) Description Parameter example
name Specifies the symbol to add to the chart (case sensitive). name=@EU#: adds IQFeed’s continuous 6E (EUR/USD) future.
df Sets the symbol’s data feed. Needs to match the data feed name exactly. name=EUR/USD, df=LMAX: adds LMAX’s EUR/USD symbol to the chart instead of MB Trading’s EUR/USD symbol.
res Defines the resolution of the added symbol. See changing the chart resolution for possible values. Defaults to the last used resolution when omitted. res=30min: adds the symbol with a 30 minute time frame.
desc Specifies the description of the symbol to add. Needs to match the QuoteManager’s description exactly. desc=E-MINI NASDAQ 100: adds the NQ future (E-mini NASDAQ 100) to the chart.
from, to Sets the data range of the symbol to add. The required date format depends on your Windows settings and is either day/month/year or month/day/year (Andrew MultiCharts, 2014). Defaults to the last used data range when these parameters are missing. from=1/1/2014, to=1/1/2015: sets the data range to the full year of 2014.
bfm Defines whether a daily-based chart (day, week, month, quarter, or year time frame) needs to be based on minute (bfm=1) or daily (bfm=0) price data. With bfm missing, daily-based charts are made with daily price data. res=1day, bfm=1: creates a daily chart based on minute data.
, The comma is used to separate multiple .isy parameters. .isy name=EUR/AUD, res=60min.

Changing price chart resolutions with the Command Line

Several commands (.csy, .isy, and .rld) have a res (resolution) parameter. These are the resolution values of the Command Line (MultiCharts Wiki, 2014):

Resolution type Values Example
Tick tick, ticks, t, or ts res=250 tick: builds a 250 tick chart.
Contract volume, volumes, contract, or contracts res=1000 contract: makes a volume chart of 1000 contracts per bar.
Point point, points, pt, or pts res=2 pts: constructs a 2 point chart.
Point Original point(original), orpt, or orpts res=4 orpt: assembles a 4 point (original) time frame.
Change change, changes, chg, or chgs res=10 chg: builds a 10 change chart.
Second second, seconds, sec, or secs res=30 secs: sets a data series to a 30 seconds time frame.
Minute minute, minutes, min, or mins res=15 min: constructs a 15 minute chart.
Hour hour, hours, hr, or hrs res=1 hours: creates a resolution of 1 hour.
Day day, days, d, or ds res=1 d: for a 1 day time frame.
Week week, weeks, wk, or wks res=1 wk: assembles a 1 week time frame.
Month month, months, mth, or mths res=1 mths: for a resolution of 1 month.
Quarter quarter, quarters, qrt, or qrts res=2 quarter: creates a time frame of six months.
Year year, years, yr, or yrs res=1 yrs: constructs a 1 year time frame.

Adding indicators programmatically to the MultiCharts .NET chart

The .iind command adds an indicator to the chart (MultiCharts Wiki, 2014). Using it programmatically looks like:

ChartCommands.CommandLine(".iind name=MACD");

This command has the following parameters (MultiCharts Wiki, 2014):

Parameter Description Parameter example
name Specifies the indicator name, which needs to match exactly. When this parameter is missing, the ‘Insert Study’ window is opened when .iind is executed. name=Mov_Avg_Exponential adds the EMA indicator to the chart.
base Data series number to calculate the indicator on (optional; defaults to 1). To see the data series numbers, right-click on the chart and select ‘Format Instruments’ (look for the ‘Data #’ column): the second data series on the chart doesn’t necessarily is has the number 2. base=3 will base the indicator’s calculations on the third data series.
bref The maximum number of bars the indicator will reference (MaxBarsBack). Optional; defaults to the user’s default value (right-click on an indicator, select ‘Format [indicator name]’ and select the ‘Properties’ tab to see the MaxBarsBack value). bref=100 sets the MaxBarsBack of the indicator to 100.
fmt Specifies whether the ‘Format Study’ window should be displayed when .iind is executed. By default, it’s not shown. Adding the fmt parameter shows the ‘Format Study’ window, while omitting this parameter won’t bring it up.
, The comma separates multiple .iind commands. .iind name=RSI, bref=20

This command can also be used to add a list of indicators to the chart. By verifying if a script exists we can prevent failing .iind and .isig commands.

Adding MultiCharts .NET trading strategies to the chart programmatically

The .isig command adds a trading strategy to the chart (MultiCharts Wiki, 2014) and basically looks like:

ChartCommands.CommandLine(".isig name1=MACD_LE");

.isig has the following parameters (MultiCharts Wiki, 2014):

Parameter Description Parameter example
nameN Specifies the trading strategy to add to the chart. nameN can go up to 99 (name1, name2, name3, etc) and needs to match a strategy’s name exactly (naming errors can be prevented by verifying if a script exists). name1=RSI_LE, name2=RSI_SE for adding these two strategies to the chart.
, Separates multiple name_N_ parameters used in a .isig command. name1=EMA_LE, name2=EMA_SE.

Working with trading strategies through the Command Line

A trading strategy’s ‘Strategy Performance Report’ is displayed by the .rep command (MultiCharts Wiki, 2014). This command is used as follows:

ChartCommands.CommandLine(".rep");

The .at_toggle command enables or disables automated trading (MultiCharts Wiki, 2014). Since it has no parameters, using it is straightforward:

ChartCommands.CommandLine(".at_toggle");

Reloading price data with the Command Line in MultiCharts .NET

The .rld command reloads price data (MultiCharts Wiki, 2014). In simple form it looks like:

ChartCommands.CommandLine(".rld");

This command has the following parameters (MultiCharts Wiki, 2014):

Parameter Description Example
glob Global reload: reloads the full data range of all data series on all charts in all workspaces. .rld glob
res Reloads data series on the current chart with the specified resolution. See changing the resolution with the Command Line for all resolution values. .rld res=15 min: reloads the 15 minute data series.
int Specifies the number of days, weeks, or months that need to be loaded (based on calendar days, not trading days). .rld int=3 day reloads the last three days, .rld int=2 weeks the last two weeks, and .rld int=1 month the last month.
(no parameter) .rld without parameters reloads the full data range of all data series on the chart. .rld

The .rld command can, for example, be used for reloading real-time data gaps and reloading data to fix price spikes.

.rld is the only command that can affect data series outside the current chart: when it reloads price data, data series with the same symbol and base data type (tick, minute, or day) are refreshed (Henry MultiCharts, 2013). Scripts on those refreshed data series will be recalculated, which has consequences such as turning off automated trading.

Summary

This concludes the ‘chapter’ on the MultiCharts .NET Command Line. See all MultiCharts .NET programming articles to explore other topics.


References

Andrew MultiCharts (2014, October 6). Command line to change start date – forum discussion. Retrieved on November 21, 2014, from http://www.multicharts.com/discussion/viewtopic.php?f=1&t=47294#p108924

Henry MultiCharts (2013, August 28). Reload data of chart – forum discussion. Retrieved on December 16, 2014, from http://www.multicharts.com/discussion/viewtopic.php?f=1&t=45236#p97765

MultiCharts Wiki (2014, August 18). MultiCharts Work Area: Understanding Command Line. Retrieved on December 20, 2014, from http://www.multicharts.com/trading-software/index.php/MultiCharts_Work_Area#Understanding_Command_Line

PowerLanguage .NET Help (n.d.). Retrieved on November 18, 2014, from http://www.multicharts.com/downloads/PowerLanguage.NET.chm