i am trying to do somthing like Current OHL Indikator.
But i try to do Arrows Down on all DailyHigh and only 1 Arrow Up with DrawText (Counter) by the the next Candle where goes under the dailyhigh candle. Now i have the problem thats draw on all candles. See my Screenshot.
#region Variables
private DateTime currentDate = Cbi.Globals.MinDate;
private double currentOpen = double.MinValue;
private double currentHigh = double.MinValue;
private double currentLow = double.MaxValue;
private bool plotCurrentValue = false;
private bool showOpen = true;
private bool showHigh = true;
private bool showLow = true;
private int counter;
private Color colorUp = Color.Gray;
private Color colorDn = Color.Gray;
#endregion
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Orange, 2), PlotStyle.Square, "Current Open"));
Add(new Plot(new Pen(Color.Green, 2), PlotStyle.Square, "Current High"));
Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Square, "Current Low"));
Plots[0].Pen.DashStyle = DashStyle.Dash;
Plots[1].Pen.DashStyle = DashStyle.Dash;
Plots[2].Pen.DashStyle = DashStyle.Dash;
AutoScale = false;
Overlay = true;
counter = 1;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
currentHigh = Math.Max(currentHigh, High[0]);
currentLow = Math.Min(currentLow, Low[0]);
bool sameDay = true;
if (currentDate != Bars.GetTradingDayFromLocal(Time[0]) || currentOpen == double.MinValue)
{
currentOpen = Open[0];
currentHigh = High[0];
currentLow = Low[0];
sameDay = false;
counter = 1;
}
if (currentHigh>High[0] && sameDay)
{
DrawArrowUp("Up"+CurrentBar, false, 0, Low[0] - (2 * TickSize), colorUp); Print("Up");
DrawText("tag"+CurrentBar, ""+counter, 0, Low[0] - (7 * TickSize), Color.Green);
counter++;
} else {
DrawArrowDown("Dn"+CurrentBar, false, 0, High[0] + (2 * TickSize), colorDn); Print("Dn");
}
currentDate = Bars.GetTradingDayFromLocal(Time[0]);
}
Thanks

Comment