IndicatorArea
interface cAlgo.API
Represents the area where the Indicator is placed.
Definition
public interface IndicatorArea
Namespace: cAlgo.API · Group: Chart · Implements: ChartArea
Examples
using cAlgo.API;
namespace cAlgo
{
// This sample indicator shows how to use IndicatorArea
public partial class IndicatorAreaSample : Indicator
{
private TextBlock _indicatorAreaNumberTextBlock;
protected override void Initialize()
{
var grid = new Grid(1, 2)
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
BackgroundColor = Color.Gold,
Opacity = 0.7,
Width = 200
};
grid.AddChild(new TextBlock { Text = "Indicator Area #", Margin = 5, FontWeight = FontWeight.ExtraBold, ForegroundColor = Color.Black }, 0, 0);
_indicatorAreaNumberTextBlock = new TextBlock
{
Margin = 5,
Text = Chart.IndicatorAreas.Count.ToString(),
FontWeight = FontWeight.ExtraBold,
ForegroundColor = Color.Black
};
grid.AddChild(_indicatorAreaNumberTextBlock, 0, 1);
IndicatorArea.AddControl(grid);
Chart.IndicatorAreaAdded += Chart_IndicatorAreaAdded;
Chart.IndicatorAreaRemoved += Chart_IndicatorAreaRemoved;
}
private void Chart_IndicatorAreaRemoved(IndicatorAreaRemovedEventArgs obj)
{
_indicatorAreaNumberTextBlock.Text = Chart.IndicatorAreas.Count.ToString();
}
private void Chart_IndicatorAreaAdded(IndicatorAreaAddedEventArgs obj)
{
_indicatorAreaNumberTextBlock.Text = Chart.IndicatorAreas.Count.ToString();
}
public override void Calculate(int index)
{
}
}
}
import clr
clr.AddReference("cAlgo.API")
from cAlgo.API import *
class Test():
def get_text_block(self, text):
textBlock = TextBlock()
textBlock.Margin = Thickness(5)
textBlock.Text = text
textBlock.FontWeight = FontWeight.ExtraBold
textBlock.ForegroundColor = Color.Black
return textBlock
def update_indicators_area_count(self):
self.indicatorAreaNumberTextBlock.Text = str(api.Chart.IndicatorAreas.Count)
def initialize(self):
grid = Grid(1, 2)
grid.HorizontalAlignment = HorizontalAlignment.Center
grid.VerticalAlignment = VerticalAlignment.Center
grid.BackgroundColor = Color.Gold
grid.Opacity = 0.7
grid.Width = 200
grid.AddChild(self.get_text_block("Indicator Area #"), 0, 0)
self.indicatorAreaNumberTextBlock = self.get_text_block(str(api.Chart.IndicatorAreas.Count))
grid.AddChild(self.indicatorAreaNumberTextBlock, 0, 1)
api.IndicatorArea.AddControl(grid)
api.Chart.IndicatorAreaAdded += lambda _: self.update_indicators_area_count()
api.Chart.IndicatorAreaRemoved += lambda _: self.update_indicators_area_count()
{
"AccessRights": "None",
"TimeZone": "UTC",
"IsOverlay": false
}
Inherited members
From ChartArea: AddControl, RemoveControl, MoveControl, SetYRange, FindAllObjects, FindObject, RemoveObject, RemoveAllObjects, DrawHorizontalLine, DrawVerticalLine, DrawTrendLine, DrawEquidistantChannel, DrawText, DrawStaticText, DrawIcon, DrawFibonacciRetracement, DrawFibonacciExpansion, DrawFibonacciFan, DrawFibonacciArc, DrawGannFan, DrawGannBox, DrawGannSquare, DrawGannSquareFixed, DrawFibonacciTimezones, DrawAndrewsPitchfork, DrawElliottImpulse, DrawElliottCorrection, DrawElliottTriangle, DrawElliottDoubleCombo, DrawElliottTripleCombo, DrawRectangle, DrawEllipse, DrawTriangle, DrawArrow, XToTime, TimeToX, YToYValue, YValueToY, XToBarIndex, BarIndexToX, ResetPriceScale, IsAlive, Width, Height, BottomY, TopY, Objects, SelectedObjects, Draggables, IsAutoScaleEnabled, MouseEnter, MouseLeave, MouseMove, MouseDown, MouseUp, MouseWheel, DragStart, DragEnd, Drag, SizeChanged, ScrollChanged, ObjectsAdded, ObjectsUpdated, ObjectsRemoved, ObjectsSelectionChanged, ObjectHoverChanged, ObjectsMoveStarted, ObjectsMoving, ObjectsMoveEnded, PriceScaleChanged