Bad ticks or data gaps can distort price data. Reloading the chart with new data from the data feed can help, but how can we do that programmatically?

Reloading price data programmatically in MultiCharts .NET

Price data on the chart can be reloaded with the .rld command (MultiCharts Wiki, 2014a). Like the other Command Line commands, .rld is executed programmatically with the ChartCommands.CommandLine() method (PowerLanguage .NET Help, n.d.).

The basic usage of .rld looks as follows:

ChartCommands.CommandLine(".rld");

This statement programmatically reloads the full data range of all data series on the chart.

Reloading price data in MultiCharts .NET and refreshing other charts

The .rld command is the only Command Line command that can affect data series outside of the chart window in which it’s executed. This behaviour is related to the three base data types, which are tick, minute, and daily (MultiCharts Wiki, 2014b).

When a symbol is reloaded from the data feed with .rld, the same symbol with the same base data type on other charts is refreshed (Henry MultiCharts, 2013). So, reloading a 200 tick ES (E-mini S&P500) chart will refresh the ES 33 tick chart (because they share the same base data type), but not the 15 minute ES chart (due to the different base data type).

Tip: Any indicators or trading strategies on data series that are refreshed will be reloaded, which can have unintended consequences (such as turning off automated trading).

Options for reloading price data in MultiCharts .NET

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

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

Reloading price data with a MultiCharts .NET indicator

In the programming example we reload price data with mouse clicks in the OnMouseEvent() method:

protected override void OnMouseEvent(MouseClickArgs arg)
{
    if (arg.buttons == MouseButtons.Left)
    {
        if (arg.keys == Keys.Control)
        {
            ChartCommands.CommandLine(".rld int=5 day");
        }
        else if (arg.keys == Keys.Shift)
        {
            ChartCommands.CommandLine(".rld int=3 day, res=30min");
        }
    }
}

The first if statement determines whether the mouse click on the chart (specified by arg.buttons) happened with the left mouse button (MouseButtons.Left). When that is the case, an if-else statement evaluates which keyboard key was pressed down during this click (accessible through the arg.keys variable).

When the Control key was pressed, the ChartCommands.CommandLine() method is called with a string argument that contains the .rld command and the int=5 day parameter. Executing that command reloads five calendar days of price data for all data series on the chart.

Should the Shift key be pressed during the mouse click, another string with the .rld command is passed to ChartCommands.CommandLine(). This time with two parameters: int=3 day specifies that three days need to be loaded, and res=30 min ensures that this reload only applies to the 30 minute data series of the chart.

For more examples of reloading price data in MultiCharts .NET, see reloading with real-time data gaps and reloading data to fix price spikes.

Summary

The .rld Command Line command reloads price data and is executed programmatically with the ChartCommands.CommandLine() method. This command has several parameters, including res (resolution to reload) and int (amount of data to reload).

Complete MultiCharts .NET indicator example

using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using System.Windows.Forms;     // For the Keys and MouseButtons enumerations

namespace PowerLanguage.Indicator
{
    [SameAsSymbol(true), MouseEvents(true)]
    public class Example_ReloadPriceData : IndicatorObject
    {
        public Example_ReloadPriceData(object _ctx) : base(_ctx) { }

        protected override void CalcBar() { } 

        protected override void OnMouseEvent(MouseClickArgs arg)
        {
            if (arg.buttons == MouseButtons.Left)
            {
                if (arg.keys == Keys.Control)
                {
                    ChartCommands.CommandLine(".rld int=5 day");
                }
                else if (arg.keys == Keys.Shift)
                {
                    ChartCommands.CommandLine(".rld int=3 day, res=30min");
                }
            }
        }
    }
}

References

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 (2014a, August 18). MultiCharts Work Area: Understanding Command Line. Retrieved on December 16, 2014, from http://www.multicharts.com/trading-software/index.php/MultiCharts_Work_Area#Understanding_Command_Line

MultiCharts Wiki (2014b, June 11). Tick, Minute and Daily Data. Retrieved on December 16, 2014, from http://www.multicharts.com/trading-software/index.php/Tick,_Minute_and_Daily_Data

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