MultiCharts .NET logo

The MultiCharts .NET language reference provides a complete overview of all PowerLanguage .NET code elements around a certain topic. They contain brief examples, helpful notes and tips, and are a quick lookup and refresher when you’re coding.

Besides the reference articles listed on this page, there are also MultiCharts .NET articles and tutorials and MultiCharts .NET programming recipes.

Trading strategies

Strategy settings

icon The following properties return information about the strategy’s settings (both for strategies that we add to a single chart as well as strategies that run in the Portfolio Trader):

Code element Description
Commission Returns the first level of the strategy’s commission rule.
InitialCapital Returns the strategy’s initial capital.
InterestRate Returns the strategy’s interest rate setting.
Slippage Returns the strategy’s slippage setting.

Back to table of contents ↑

Strategy performance

icon The properties listed below return information about the strategy’s performance, for strategies that run on a chart as well as those active in the Portfolio Trader:

Code element Description
AvgBarsEvenTrade Returns the average length of completed break-even trades in number of bars.
AvgBarsLosTrade Returns the average length of completed losing trades in number of bars.
AvgBarsWinTrade Returns the average length of completed winning trades in number of bars.
GrossLoss Returns the strategy’s total loss based on all completed trades.
GrossProfit Returns the strategy’s total profit based on all completed trades.
LargestLosTrade Returns the strategy’s largest losing trade.
LargestWinTrade Returns the strategy’s largest winning trade.
MaxConsecLosers Returns the strategy’s maximum number of completed losing trades in a row.
MaxConsecWinners Returns the strategy’s maximum number of completed winning trades in a row.
MaxDrawDown Returns the strategy’s maximum drawdown based on closed trades.
MaxLotsHeld Returns the strategy’s largest position size during the entire backtest period.
NetProfit Returns the strategy’s net profit from all closed trades.
NumEvenTrades Returns the strategy’s total amount of completed break-even trades.
NumLosTrades Returns the strategy’s total amount of completed losing trades.
NumWinTrades Returns the strategy’s total amount of completed profitable trades.
PercentProfit Returns the percentage of completed winning trades in relation to the total number of trades.
StrategyInfo.ClosedEquity Returns the strategy’s net profit of all closed trades.
StrategyInfo.OpenEquity Returns the strategy’s net profit of all closed trades plus the profit & loss of the currently open position.
TotalBarsEvenTrades Returns the total number of bars during which closed break-even trades were open.
TotalBarsLosTrades Returns the total number of bars during which losing trades were kept open.
TotalBarsWinTrades Returns the total number of bars during which profitable trades were kept open.
TotalTrades Returns the total number of completed trades during the entire backtest period.

Back to table of contents ↑

Drawings

General drawings

icon In this section we explore the different properties and method for working with drawings in MultiCharts .NET. We can use each of the code elements below with arrows, text boxes, and trend lines.

Code element Description
IDrawObject.AnchorToBars Returns or sets whether a particular drawing (arrow, text box, or trend line) is anchored to price bars or not.
IDrawObject.Delete() Removes a particular drawing (arrow, text box, or trend line) from the chart.
IDrawObject.Exist Returns whether a particular drawing (arrow, text box, or trend line) is present on the chart.
IDrawObject.ID Returns the numerical identifier of a particular drawing (arrow, text box, or trend line).
IDrawObject.Locked Returns or sets the locked state of a particular drawing (arrow, text box, or trend line).

Back to table of contents ↑

Arrows

icon Below we explore the different arrow properties and methods. With these we can create arrows, relocate them, change their colour and size, and add text to the arrows.

Code element Description
DrwArrow.Active Returns an IArrowObject reference to the chart’s currently active arrow.
DrwArrow.Create() Draws an arrow on the price chart and returns an IArrowObject reference needed to work with the arrow afterwards.
DrwArrow.GetArrowObjects() Returns a collection of IArrowObject references that point to the chart’s arrows.
IArrowObject.Color Returns or sets the colour of a particular arrow.
IArrowObject.Direction Returns the direction of a particular arrow.
IArrowObject.FontName Returns or sets the font family used by a particular arrow’s text.
IArrowObject.HaveFont() Returns whether a particular arrow’s text uses a certain font style.
IArrowObject.Location Returns or sets the chart location of a particular arrow.
IArrowObject.SetFont() Sets the font style used by the text of a particular arrow.
IArrowObject.Size Returns or sets the size of a particular arrow.
IArrowObject.Style Returns or sets the visual style of a particular arrow.
IArrowObject.TextBGColor Returns or sets the background colour of particular arrow’s text.
IArrowObject.TextColor Returns or sets the text colour of a particular arrow.
IArrowObject.TextSize Returns or sets the text size of a particular arrow in points.
IArrowObject.Text Returns or sets the text that’s displayed above or below a particular arrow.

Back to table of contents ↑

Text boxes

icon The following table contains the different properties and methods for working with text boxes in MultiCharts .NET. We can use these to create or retrieve text boxes and change their text, colour, size, and more.

Code element Description
DrwText.Active Returns an ITextObject text box reference to the chart’s currently active text box.
DrwText.Create() Draws a text box on the price chart and returns an ITextObject reference needed to work with the text box afterwards.
DrwText.GetTextObjects() Returns a collection of ITextObject references that point to the chart’s text boxes.
ITextObject.BGColor Returns or sets the background colour of a particular text box.
ITextObject.Border Returns or sets the border of a particular text box.
ITextObject.Color Returns or sets the text colour of a particular text box.
ITextObject.FontName Returns or sets the font family used by the text of a particular text box.
ITextObject.HStyle Returns or sets how a particular text box is positioned horizontally.
ITextObject.HaveFont() Returns whether a certain font style is applied to the text of a particular text box.
ITextObject.Location Returns or sets the chart location of a particular text box.
ITextObject.SetFont() Sets the content of a particular text box to a certain font style formatting.
ITextObject.Size Returns or sets the font size of a particular text box.
ITextObject.Text Returns or sets the text of a particular text box.
ITextObject.VStyle Returns or sets the vertical alignment of a particular text box.

Back to table of contents ↑

Trend lines

icon Below we look at the different trend line properties and methods. These allow us to create trend lines, extend them indefinitely, get their future or past price value, change their visual appearance, and more.

Code element Description
DrwTrendLine.Active Returns an ITrendLineObject trend line reference of the chart’s active arrow.
DrwTrendLine.Create() Draws a trend line on the price chart and returns an ITrendLineObject reference needed to work with the trend line afterwards.
DrwTrendLine.GetTrendLineObjects() Returns a collection of ITrendLineObject references that point to the chart’s trend lines.
ITrendLineObject.Alert Returns or sets a particular trend line’s alert status to disabled, intra-bar alert, or on bar close alert.
ITrendLineObject.Begin Returns or sets the time and price coordinates of a particular trend line’s begin point.
ITrendLineObject.Color Returns or sets the colour of a particular trend line.
ITrendLineObject.End Returns or sets the time and price coordinates of a particular trend line’s end point.
ITrendLineObject.ExtLeft Returns or sets the indefinite extension of a particular trend line to the left.
ITrendLineObject.ExtRight Returns or sets the indefinite extension of a particular trend line to the right.
ITrendLineObject.PriceValue() Returns the price value of a particular trend line for the specified date and time.
ITrendLineObject.Size Returns or sets the size of a particular trend line.
ITrendLineObject.Style Returns or sets the visual style of a particular trend line.

Back to table of contents ↑

Environment

Environment information

icon The code elements listed below return various pieces of information about the environment in which a MultiCharts .NET script runs. With them, we can determine if the script calculates in the Portfolio Trader or on a price chart, whether automated trading is enabled, or what the chart window’s settings are.

Code element Description
Environment.ApplicationCode Returns a value from the EApplicationCode enumeration that specifies in which environment the script runs.
Environment.BGColor Returns a Color value with either the background colour of the chart or the Scanner/Watchlist row.
Environment.BarSpacing Returns the chart’s current bar spacing in pixels.
Environment.CalcReason Returns a value from the CalculationReason enumeration that specifies what triggered the current script calculation.
Environment.ChartShiftBars Returns the price chart’s current ‘Chart Shift’ setting in number of price bars.
Environment.ChartShiftPcnt Returns the price chart’s current ‘Chart Shift’ setting as a percentage of the chart window’s size.
Environment.ChartWindowHWND Returns the window handle of where the script currently calculates.
Environment.HighestScaleValue Returns the highest value of the price axis from the currently displayed chart area.
Environment.IOGEnabled Returns whether the signal’s intra-bar order generation setting is enabled or disabled.
Environment.IsAutoTradingMode Returns whether the strategy’s automated order execution setting (that is, auto trading) is on or off.
Environment.IsRealTimeCalc Returns whether the script currently calculates on real-time data or not.
Environment.LeftScreenTime Returns the date and time value of the current chart window’s very left price bar.
Environment.LowestScaleValue Returns the lowest value of the price axis from the currently displayed chart area.
Environment.Optimizing Returns whether the strategy is currently being optimised on (genetic, exhaustive, and walk-forward optimisation).
Environment.OrderConfirmationRequired Returns, when the strategy’s auto trading is enabled, whether manual order confirmation is on or off.
Environment.RightScreenTime Returns the date and time of the current chart window’s very right.
Environment.ScannerRow Returns the Scanner/Watchlist row number of the symbol that the script calculates on.
Environment.UserID Returns the 10-digit ‘User ID’ value from the current MultiCharts .NET installation.
Environment.UserName Returns the user’s license name of the current MultiCharts .NET installation.

Back to table of contents ↑

Alphabetical reference

Symbols

Back to table of contents ↑

A

Code element Description
AvgBarsEvenTrade Returns the average length of completed break-even trades in number of bars.
AvgBarsLosTrade Returns the average length of completed losing trades in number of bars.
AvgBarsWinTrade Returns the average length of completed winning trades in number of bars.

Back to table of contents ↑

B

Back to table of contents ↑

C

Code element Description
Commission Returns the first level of the strategy’s commission rule.

Back to table of contents ↑

D

Code element Description
DrwArrow.Active Returns an IArrowObject reference to the chart’s currently active arrow.
DrwArrow.Create() Draws an arrow on the price chart and returns an IArrowObject reference needed to work with the arrow afterwards.
DrwArrow.GetArrowObjects() Returns a collection of IArrowObject references that point to the chart’s arrows.
DrwText.Active Returns an ITextObject text box reference to the chart’s currently active text box.
DrwText.Create() Draws a text box on the price chart and returns an ITextObject reference needed to work with the text box afterwards.
DrwText.GetTextObjects() Returns a collection of ITextObject references that point to the chart’s text boxes.
DrwTrendLine.Active Returns an ITrendLineObject trend line reference of the chart’s active arrow.
DrwTrendLine.Create() Draws a trend line on the price chart and returns an ITrendLineObject reference needed to work with the trend line afterwards.
DrwTrendLine.GetTrendLineObjects() Returns a collection of ITrendLineObject references that point to the chart’s trend lines.

Back to table of contents ↑

E

Code element Description
Environment.ApplicationCode Returns a value from the EApplicationCode enumeration that specifies in which environment the script runs.
Environment.BGColor Returns a Color value with either the background colour of the chart or the Scanner/Watchlist row.
Environment.BarSpacing Returns the chart’s current bar spacing in pixels.
Environment.CalcReason Returns a value from the CalculationReason enumeration that specifies what triggered the current script calculation.
Environment.ChartShiftBars Returns the price chart’s current ‘Chart Shift’ setting in number of price bars.
Environment.ChartShiftPcnt Returns the price chart’s current ‘Chart Shift’ setting as a percentage of the chart window’s size.
Environment.ChartWindowHWND Returns the window handle of where the script currently calculates.
Environment.HighestScaleValue Returns the highest value of the price axis from the currently displayed chart area.
Environment.IOGEnabled Returns whether the signal’s intra-bar order generation setting is enabled or disabled.
Environment.IsAutoTradingMode Returns whether the strategy’s automated order execution setting (that is, auto trading) is on or off.
Environment.IsRealTimeCalc Returns whether the script currently calculates on real-time data or not.
Environment.LeftScreenTime Returns the date and time value of the current chart window’s very left price bar.
Environment.LowestScaleValue Returns the lowest value of the price axis from the currently displayed chart area.
Environment.Optimizing Returns whether the strategy is currently being optimised on (genetic, exhaustive, and walk-forward optimisation).
Environment.OrderConfirmationRequired Returns, when the strategy’s auto trading is enabled, whether manual order confirmation is on or off.
Environment.RightScreenTime Returns the date and time of the current chart window’s very right.
Environment.ScannerRow Returns the Scanner/Watchlist row number of the symbol that the script calculates on.
Environment.UserID Returns the 10-digit ‘User ID’ value from the current MultiCharts .NET installation.
Environment.UserName Returns the user’s license name of the current MultiCharts .NET installation.

Back to table of contents ↑

F

Back to table of contents ↑

G

Code element Description
GrossLoss Returns the strategy’s total loss based on all completed trades.
GrossProfit Returns the strategy’s total profit based on all completed trades.

Back to table of contents ↑

H

Back to table of contents ↑

I

Code element Description
IArrowObject.Color Returns or sets the colour of a particular arrow.
IArrowObject.Direction Returns the direction of a particular arrow.
IArrowObject.FontName Returns or sets the font family used by a particular arrow’s text.
IArrowObject.HaveFont() Returns whether a particular arrow’s text uses a certain font style.
IArrowObject.Location Returns or sets the chart location of a particular arrow.
IArrowObject.SetFont() Sets the font style used by the text of a particular arrow.
IArrowObject.Size Returns or sets the size of a particular arrow.
IArrowObject.Style Returns or sets the visual style of a particular arrow.
IArrowObject.TextBGColor Returns or sets the background colour of particular arrow’s text.
IArrowObject.TextColor Returns or sets the text colour of a particular arrow.
IArrowObject.TextSize Returns or sets the text size of a particular arrow in points.
IArrowObject.Text Returns or sets the text that’s displayed above or below a particular arrow.
IDrawObject.AnchorToBars Returns or sets whether a particular drawing (arrow, text box, or trend line) is anchored to price bars or not.
IDrawObject.Delete() Removes a particular drawing (arrow, text box, or trend line) from the chart.
IDrawObject.Exist Returns whether a particular drawing (arrow, text box, or trend line) is present on the chart.
IDrawObject.ID Returns the numerical identifier of a particular drawing (arrow, text box, or trend line).
IDrawObject.Locked Returns or sets the locked state of a particular drawing (arrow, text box, or trend line).
ITextObject.BGColor Returns or sets the background colour of a particular text box.
ITextObject.Border Returns or sets the border of a particular text box.
ITextObject.Color Returns or sets the text colour of a particular text box.
ITextObject.FontName Returns or sets the font family used by the text of a particular text box.
ITextObject.HStyle Returns or sets how a particular text box is positioned horizontally.
ITextObject.HaveFont() Returns whether a certain font style is applied to the text of a particular text box.
ITextObject.Location Returns or sets the chart location of a particular text box.
ITextObject.SetFont() Sets the content of a particular text box to a certain font style formatting.
ITextObject.Size Returns or sets the font size of a particular text box.
ITextObject.Text Returns or sets the text of a particular text box.
ITextObject.VStyle Returns or sets the vertical alignment of a particular text box.
ITrendLineObject.Alert Returns or sets a particular trend line’s alert status to disabled, intra-bar alert, or on bar close alert.
ITrendLineObject.Begin Returns or sets the time and price coordinates of a particular trend line’s begin point.
ITrendLineObject.Color Returns or sets the colour of a particular trend line.
ITrendLineObject.End Returns or sets the time and price coordinates of a particular trend line’s end point.
ITrendLineObject.ExtLeft Returns or sets the indefinite extension of a particular trend line to the left.
ITrendLineObject.ExtRight Returns or sets the indefinite extension of a particular trend line to the right.
ITrendLineObject.PriceValue() Returns the price value of a particular trend line for the specified date and time.
ITrendLineObject.Size Returns or sets the size of a particular trend line.
ITrendLineObject.Style Returns or sets the visual style of a particular trend line.
InitialCapital Returns the strategy’s initial capital.
InterestRate Returns the strategy’s interest rate setting.

Back to table of contents ↑

J

Back to table of contents ↑

K

Back to table of contents ↑

L

Code element Description
LargestLosTrade Returns the strategy’s largest losing trade.
LargestWinTrade Returns the strategy’s largest winning trade.

Back to table of contents ↑

M

Code element Description
MaxConsecLosers Returns the strategy’s maximum number of completed losing trades in a row.
MaxConsecWinners Returns the strategy’s maximum number of completed winning trades in a row.
MaxDrawDown Returns the strategy’s maximum drawdown based on closed trades.
MaxLotsHeld Returns the strategy’s largest position size during the entire backtest period.

Back to table of contents ↑

N

Code element Description
NetProfit Returns the strategy’s net profit from all closed trades.
NumEvenTrades Returns the strategy’s total amount of completed break-even trades.
NumLosTrades Returns the strategy’s total amount of completed losing trades.
NumWinTrades Returns the strategy’s total amount of completed profitable trades.

Back to table of contents ↑

O

Back to table of contents ↑

P

Code element Description
PercentProfit Returns the percentage of completed winning trades in relation to the total number of trades.

Back to table of contents ↑

Q

Back to table of contents ↑

R

Back to table of contents ↑

S

Code element Description
Slippage Returns the strategy’s slippage setting.
StrategyInfo.ClosedEquity Returns the strategy’s net profit of all closed trades.
StrategyInfo.OpenEquity Returns the strategy’s net profit of all closed trades plus the profit & loss of the currently open position.

Back to table of contents ↑

T

Code element Description
TotalBarsEvenTrades Returns the total number of bars during which closed break-even trades were open.
TotalBarsLosTrades Returns the total number of bars during which losing trades were kept open.
TotalBarsWinTrades Returns the total number of bars during which profitable trades were kept open.
TotalTrades Returns the total number of completed trades during the entire backtest period.

Back to table of contents ↑

U

Back to table of contents ↑

V

Back to table of contents ↑

W

Back to table of contents ↑

X

Back to table of contents ↑

Y

Back to table of contents ↑

Z

Back to table of contents ↑

Popular reference articles

icon The most popular MultiCharts .NET reference articles of the last 90 days are:

  1. Environment.ApplicationCode
  2. Environment.RightScreenTime
  3. Environment.ChartShiftBars
  4. PercentProfit
  5. StrategyInfo.OpenEquity
  6. DrwText.Create()
  7. ITextObject.Text
  8. StrategyInfo.ClosedEquity
  9. Environment.Optimizing
  10. IDrawObject.AnchorToBars
  11. InitialCapital
  12. ITrendLineObject.Color
  13. NumLosTrades
  14. Environment.IOGEnabled
  15. DrwArrow.Create()

Back to table of contents ↑