ChartIndicators
interface cAlgo.API
DesktopCLICloud
The interface representing a chart indicator instances collection. Provides properties and events that allow for accessing various information about indicators attached to a chart.
Environment behaviour
Cloud — not supported. Always empty: Count is 0, Add returns null, Remove returns false, and the events never fire.
Definition
public interface ChartIndicators
Namespace: cAlgo.API · Group: Indicators
Examples
using cAlgo.API;
namespace cAlgo.Robots;
public partial class TestExample : Robot
{
protected override void OnStart()
{
foreach (var chartIndicator in ChartIndicators)
{
Print($"Name: {chartIndicator.Name} | Type: {chartIndicator.Type} | InstanceId: {chartIndicator.InstanceId} | Bar Outputs #: {chartIndicator.BarOutputs.Count} | Line Outputs #: {chartIndicator.LineOutputs.Count}");
}
ChartIndicators.IndicatorAdded += args => Print($"Chart indicator added, {args.Indicator.Name}");
ChartIndicators.IndicatorRemoved += args => Print($"Chart indicator removed, {args.Indicator.Name}");
ChartIndicators.IndicatorModified += args => Print($"Chart indicator modified, {args.Indicator.Name}");
var sma = ChartIndicators.Add("Simple Moving Average", Bars.OpenPrices, 100);
}
}
import clr
clr.AddReference("cAlgo.API")
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
class Test():
def on_start(self):
for chartIndicator in api.ChartIndicators:
print(f"Name: {chartIndicator.Name} | Type: {chartIndicator.Type} | InstanceId: {chartIndicator.InstanceId} | Bar Outputs #: {chartIndicator.BarOutputs.Count} | Line Outputs #: {chartIndicator.LineOutputs.Count}")
api.ChartIndicators.IndicatorAdded += lambda args: print(f"Chart indicator added, {args.Indicator.Name}")
api.ChartIndicators.IndicatorRemoved += lambda args: print(f"Chart indicator removed, {args.Indicator.Name}")
api.ChartIndicators.IndicatorModified += lambda args: print(f"Chart indicator modified, {args.Indicator.Name}")
sma = api.ChartIndicators.Add("Simple Moving Average", api.Bars.OpenPrices, 100)
{
"AccessRights": "None"
}
Methods
| Name | Description |
|---|---|
Add 2 overloadsDesktopCLICloudChartIndicator | Adds a new indicator to a chart. |
RemoveDesktopCLICloudbool | Removes an indicator from a chart. |
Properties
| Name | Description |
|---|---|
CountDesktopCLICloudint | Gets the number of all indicators attached to a chart. |
CustomDesktopCLICloudIReadonlyList<ChartIndicator> | Gets the list of chart custom indicators. |
ItemDesktopCLICloudChartIndicator | Gets an indicator attached to a chart by its instance ID. |
StandardDesktopCLICloudIReadonlyList<ChartIndicator> | Gets the list of chart standard indicators. |
Events
| Name | Description |
|---|---|
IndicatorAddedDesktopCLICloudAction<ChartIndicatorAddedEventArgs> | Occurs when a new indicator is added to a chart. |
IndicatorModifiedDesktopCLICloudAction<ChartIndicatorModifiedEventArgs> | Occurs when an indicator attached to a chart is modified. |
IndicatorRemovedDesktopCLICloudAction<ChartIndicatorRemovedEventArgs> | Occurs when an indicator is removed from a chart. |