I wrote the code below in my indicator, it gives me the info I need but it results in performance probllems. Could you tell me if there is a better way to draw the objets with a lower performance impact?
protected override void OnBarUpdate()
{
Value.Set(Volume[0]);
if (ActivarVolRelevantes) // if true
{
if (Volume[0] >= VolRelev1)
{
PlotColors[0][0] = ColorVolRel1;
}
}
if (ActivarVolRelevantes)
{
if (Volume[0] >= VolRelev2)
{
PlotColors[0][0] = ColorVolRel2;
}
}
if (CurrentBar < 1) // avoid out-of-range error
return;
if (FirstTickOfBar) // Do on bar close
{
if (Volume[1] >= VolRelev1)
{
if (Close[1] > Open[1])
{
if (ActivarZonas)
{
DrawRectangle("ZonaUp1" + CurrentBar, false, 1, Close[1] - TickSize, LongitudZona*-1 , High[1] + TickSize, ColorMarcoZonaUp, ColorFondoZonaUp, OpacidadFondoZona);
}
if (ActivarMarcadoresVelas)
{
DrawLine("MarcaHUp1" + CurrentBar, false, 1, 0, 1, Low[1] - TickSize, ColorMarcaHorVelaUp, EstiloMarcaHorVelaUp, GrosorMarcaHorVelaUp);
}
}
if (Close[1] < Open[1])
{
if (ActivarZonas)
{
DrawRectangle("ZonaDown1" + CurrentBar, false,1, Close[1] + TickSize, LongitudZona*-1, Low[1] - TickSize, ColorMarcoZonaDown, ColorFondoZonaDown, OpacidadFondoZona);
}
if (ActivarMarcadoresVelas)
{
DrawLine("MarcaHDown1" + CurrentBar, false, 1, 0, 1, Low[1] - TickSize, ColorMarcaHorVelaDown, EstiloMarcaHorVelaDown, GrosorMarcaHorVelaDown);
}
}
if (Close[1] == Open[1])
{
DrawOnPricePanel = true;
DrawRectangle("ZonaEven1" + CurrentBar, false, 2, Close[1] + TickSize, 0, Open[1] - TickSize, Color.Transparent, Color.Blue, 3);
}
}

Comment