I have an indicator what works fine - simple engulfing candles. BUT: when I change the TF, zoom or currency the chart will shrink (please see attachment).
What is wrong at my source code?
using cAlgo.API;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.True)]
public class JK_EngulfingCandlev002 : Indicator
{
[Parameter(DefaultValue = 0.0)]
public double Parameter { get; set; }
[Output("Result", LineColor = "Transparent")]
public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
// Initialization logic
}
public override void Calculate(int index)
{
var engulfing = Bars.HighPrices[index] > Bars.HighPrices[index - 1]
&& Bars.LowPrices[index] < Bars.LowPrices[index - 1];
var upBar = Bars.ClosePrices[index] > Bars.OpenPrices[index];
var downBar = Bars.ClosePrices[index] < Bars.OpenPrices[index];
// Calculate value at specified index
if (engulfing && upBar)
{
Result[index] = 1;
}
else if (engulfing && downBar)
{
Result[index] = -1;
}
else
{
Result[index] = 0;
}
// Draw Arrows
if (Result[index] == 1)
{
Chart.DrawIcon(index.ToString(), ChartIconType.UpArrow, index,
Bars.LowPrices[index] - 20 * Symbol.PipSize, Color.Green);
}
else if (Result[index] == -1)
{
Chart.DrawIcon(index.ToString(), ChartIconType.DownArrow, index,
Bars.HighPrices[index] + 10 * Symbol.PipSize, Color.Red);
}
}
}
}
```