MultiCharts programming articles
All MultiCharts programming articles are listed on this page. Both the 'chapters' and the articles inside the chapters are listed in order of increasing difficulty, with the fundamentals first and ending with the more complex concepts.
The fundamentals of PowerLanguage
In the ‘Fundamentals of PowerLanguage’ part we begin with learning the basics of the MultiCharts PowerLanguage scripting language.
This chapter discusses the different ways to repeat programming code in MultiCharts PowerLanguage. The introduction provides a detailed overview of the chapter, while the summary gives a quick recap of the most important points.
Types of PowerLanguage loops
- The for-to loop in PowerLanguage
- The down-to loop in PowerLanguage
- The while loop in PowerLanguage
- The repeat-until loop in PowerLanguage
Controlling PowerLanguage loops
- Breaking out of PowerLanguage loops
- Skip a loop cycle with continue in PowerLanguage
- Controlling a loop with modulus: taking an action every nth time
Placing loops inside each other
- Loops inside each other: nesting loops in PowerLanguage
- Breaking out of nested PowerLanguage loops
- Skipping nested loop cycles in PowerLanguage
- Tip: Exit multiple nested loops at once with a function
Infinite (erroneous) loops
Attributes are used in MultiCharts PowerLanguage to enable or disable certain script features. The articles below discuss the different attributes and how they work, starting with an introduction and ending with a summary that repeats the essentials.
Attributes for every script
ProcessMouseEvents: enabling mouse click processing in a MultiCharts script
RecoverDrawings: prevent automatic removal of intra-bar drawings
LegacyColorValue: working with PowerLanguage’s old colour model
Trading script attributes
IntrabarOrderGeneration: generating trading orders with every price update
AllowSendOrdersAlways: even submit orders without price updates
SameExitFromOneEntryOnce: reusing exit orders in MultiCharts strategies
Working with PowerLanguage
In the ‘Working with PowerLanguage’ part we look at the different things we can program in PowerLanguage.
In this chapter we look at how we can process manual mouse clicks and keyboard keys programmatically in MultiCharts PowerLanguage. The chapter starts with an introduction that outlines the chapter and ends with a summary for a quick overview of using mouse clicks programmatically.
The PowerLanguage keywords for mouse clicks
- How to combine mouse clicks and keyboard keys in MultiCharts?
- Locating a mouse click’s bar number in MultiCharts
- A mouse click’s location: retrieving the y-axis’ price level of the click in MultiCharts
- A mouse click’s location: getting the x-axis’ time and date
- How to determine on which data series a click occurred?
- How to find out if a left or right mouse button clicked on the MultiCharts chart?
Using mouse clicks in scripts
- How to only calculate part of a script with a mouse click in PowerLanguage?
- Manipulating the chart with mouse clicks and the MultiCharts Command Line
- How to use mouse clicks to generate alerts in MultiCharts?
- How to determine in which chart area a click took place?
- How to calculate the distance of a mouse click to a chart’s corner?
Mouse clicks and chart drawings
- Plotting arrows based on mouse clicks in MultiCharts
- Freely draw trend lines with mouse clicks in MultiCharts
- Using mouse clicks to draw trend lines that snap to price bars
- Creating text boxes with mouse click data from any data series
Mouse clicks and trading strategies
In this chapter we look at the different ways at which we can work with MultiCharts alerts in PowerLanguage. The chapter begins with an introduction to outline the chapter and ends with a summary for a quick overview.
Using alerts manually
- How to enable MultiCharts alerts by hand?
- How to configure MultiCharts alerts manually?
- How to generate alerts with manual drawings?
- Using the historical log of alerts messages in the Order and Position Tracker
Generating alerts with code
- How to generate an alert programmatically?
- How to programmatically check if MultiCharts alerts are enabled?
- How to cancel an alert before it fires?
- Using code to enable alerts that were cancelled previously
- How to execute certain code only when alerts are enabled?
Formatting MultiCharts alert messages
- How to add formatted numbers to MultiCharts alert messages?
- How to programmatically format times in MultiCharts alert messages?
- How to include a readable date in MultiCharts alerts?
Preventing a flood of alert messages
- How to only generate alerts when the bar closes?
- Using code to only trigger an alert once per bar
- How to limit the number of alerts generated per bar?
- How to fire an alert every number of times the alert condition happens?
- How to keep a certain number of seconds between alerts?
- How to combine an intra-bar alert with one that fires on bar close?
- How to only generate MultiCharts alerts during a certain time period?
- Tip: don’t use
SetAlertState()and get clearer code
- 5 ways to limit the number of alerts a MultiCharts script generates
- Trigger an error message when alerts are disabled
- Tip: create a notifying text box when MultiCharts alerts are disabled
- Tip: recalculate a script periodically for up-to-date alerts
Examples of using MultiCharts alerts
- How to generate an alert for a moving average crossover?
- How to trigger MultiCharts alerts for possible data feed issues?
- Enabling or disabling MultiCharts alerts with a single mouse click
- How to generate alerts based on MultiCharts trend lines?
- How to create a semi-automatic price-based alert with mouse clicks?
Examples of using MultiCharts alerts in strategies
- How to trigger an alert when we didn’t enable auto trading?
- How to fire an alert when automated trading gets disabled?
- How to generate an alert when the strategy’s position changes?
- Generating alerts when the broker position doesn’t match the chart’s position
Summary & recap