Sorry wrong button pressed ;-)
Here it is again
ChartRectangle doe not respec the y2 setting
source:
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class NewIndicator : Indicator
{
[Parameter(DefaultValue = 10)]
public int Width { get; set; }
[Parameter("Color", DefaultValue = "FFFF0000")]
public string P_Color { get; set; }
[Parameter("Color2", DefaultValue = "FFFFFFFF")]
public string P_Color2 { get; set; }
//[Output("Main")]
//public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
int LastIndex=Bars.Count-1;
Bar ThisBar = Bars[LastIndex - Width];
double Half = (ThisBar.High - ThisBar.Low) / 2;
int Start = LastIndex - Width * 2;
int End = LastIndex - Width;
Print( Start + " " + Half + " " + End + " " + ThisBar.Low);
ChartRectangle MyDrawing = Chart.DrawRectangle("Fig1" + Width,
Start, ThisBar.High, End, Half,
P_Color);
MyDrawing.IsFilled = MyDrawing.IsLocked = MyDrawing.IsInteractive = true;
MyDrawing.Comment = Width + " H:" + ThisBar.High + " L:" + Half;
ChartRectangle MyDrawing2 = Chart.DrawRectangle("Fig2" + Width,
Start, Half, End, ThisBar.Low,
P_Color2);
MyDrawing2.IsFilled = MyDrawing2.IsLocked = MyDrawing2.IsInteractive = true;
MyDrawing2.Comment = Width + " H:" + Half + " L:" + ThisBar.Low;
}
public override void Calculate(int index)
{
// Calculate value at specified index
// Result[index] = ...
}
}
}