Trying to use a cursorBarIndex value in OnBarUpdate(), cant fixe this my Period wont be replace by cursorBarIndex.
Any pointers?
public class GAPoffset : Indicator
{
private int cursorBarIndex = -1;
protected override void OnBarUpdate()
{
if (Bars == null || CurrentBar < 1)
{
return;
}
// ... (other variable declarations remain the same)
int startIndex = Math.Max(1, cursorBarIndex == -1 ? CurrentBar - 1 : cursorBarIndex);
int startAgo = Math.Max(1, cursorBarIndex == -1 ? CurrentBar : cursorBarIndex);
// ... (rest of the method remains largely the same)
}
public void UpdateCursorPosition(ChartControl chartControl, int cursorPointX)
{
cursorBarIndex = ChartBars.GetBarIdxByX(chartControl, cursorPointX);
Calculate = Calculate.OnBarClose;
}
}
TY

Comment