Indicator Scripts#
PowerLanguage has two main script types: Signal and Indicator. A Signal script places buy and sell orders; an Indicator script draws calculated values on the chart — moving averages, RSI, Bollinger Bands, and so on.
Both script types share the same syntax. The key difference is that an Indicator uses the Plot function to output values to the chart, whereas a Signal uses Buy, Sell, and related order commands.
The Plot Function#
The Plot function draws a value onto the chart. Each indicator supports up to 999 lines, named Plot1 through Plot999.
Syntax#
| |
| Parameter | Description |
|---|---|
Value | The numeric value to draw |
Name | Label shown in the chart legend |
Color | Line color — use a color name (e.g. Red) or RGB(R, G, B). Omit to use the default color |
Width | Line width as an integer. Omit to use the default width |
Color and Width are both optional; omitted parameters fall back to the chart’s default settings.
Examples#
| |
Setting Colors#
Instead of setting color once inside the Plot call, you can update it bar-by-bar using SetPlotColor and SetPlotWidth.
SetPlotColor(PlotNumber, Color)#
Dynamically sets the color of a plot line.
| Parameter | Description |
|---|---|
PlotNumber | Line number corresponding to Plot1–Plot999 |
Color | Color name or RGB(R, G, B) |
SetPlotWidth(PlotNumber, Width)#
Dynamically sets the width of a plot line.
| Parameter | Description |
|---|---|
PlotNumber | Line number |
Width | Width as an integer |
NoPlot(PlotNumber)#
Clears the drawn point for a specified plot on the current bar.
The typical use case is conditional plotting: Plot is called only when a condition is true. In real-time, the open bar is recalculated on every new tick, and the condition may flip from true back to false. The point that was already drawn does not disappear on its own — you must call NoPlot to remove it.
| |
| Parameter | Description |
|---|---|
PlotNumber | Line number |
Dynamic Colors#
Changing a line’s color based on a condition is a common indicator technique — for example, green when price rises and red when it falls.
| |
Complete Example: MA Crossover Indicator#
The indicator below draws a fast and a slow moving average. The fast line turns green when it is above the slow line, and red when it is below.
| |
Two lines appear on the chart:
Plot1(FastMA): color changes dynamically — green when the fast MA is above the slow MA, red otherwise.Plot2(SlowMA): fixed white color, width 2.
Reference#
https://www.multicharts.com/trading-software/index.php?title=Plot
https://www.multicharts.com/trading-software/index.php?title=SetPlotColor
https://www.multicharts.com/trading-software/index.php?title=SetPlotWidth
https://www.multicharts.com/trading-software/index.php?title=NoPlot