How to draw multiple same Chart Objects
23 Jun 2015, 13:27
Hello,
I am looking to spawn several vertical lines on the chart when the conditions are met.
The problem is that ChartObjects.DrawVerticalLine(); creates one line only.
I am using something like this in calculate:
for (int i = index - 20; i <= index; i++)
{
ChartObjects.DrawVerticalLine("line", index, Colors.Orange);
}
Normally it shoud draw a Line at each Bar but it does that one the last one only.
What's the problem?
Thanks
Replies
WhiteSage
25 Jun 2015, 16:50
Thats pretty much what I was going to suggest!
Objects must have unique names, that was they can be changed or deleted ;)
@WhiteSage

Vlad_Wulf
23 Jun 2015, 13:40
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewIndicator : Indicator { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } [Output("Main")] public IndicatorDataSeries Result { get; set; } int iterator = 0; protected override void Initialize() { // Initialize and create nested indicators } public override void Calculate(int index) { string lineName = "line" + iterator; for (int i = index - Period; i <= index; i++) { ChartObjects.DrawVerticalLine(lineName, index, Colors.Orange); iterator += 1; } } } }Nevermind I resolved it this way.
@Vlad_Wulf