this is the mouse click code
protected void MouseClicked(object sender, MouseButtonEventArgs e)
{
clickPoint.X = ChartingExtensions.ConvertToHorizontalPixels(e.GetPosition(ChartControl as IInputElement).X, ChartControl.PresentationSource);
clickPoint.Y = ChartingExtensions.ConvertToVerticalPixels(e.GetPosition(ChartControl as IInputElement).Y, ChartControl.PresentationSource);
if(clickPoint.Y > 50 && clickPoint.Y < ChartPanel.H - 150 && clickPoint.X < ChartPanel.W - 200)
{
CheckForMTF(IFVGopen);
CheckForMTF(IFVGclosed);
}
A mouse click runs this code
private void CheckForMTF(List<FVG> myList)
{
showMTF = 0;
{
double anchorPrice = Instrument.MasterInstrument.RoundToTickSize(chartScale.GetValueByY((float)clickPoint.Y));
DateTime clickTime = ChartControl.GetTimeBySlotIndex((int)ChartControl.GetSlotIndexByX((int)clickPoint.X));
for (int index = myList.Count - 1; index >= 0 ; index--)
{
currentTopMTF = myList[index].top;
currentBottomMTF = myList[index].bottom;
currentLeftMTF = myList[index].gapStartTime;
currentRightMTF = myList[index].gapEndTime;
if (currentTopMTF >= anchorPrice && currentBottomMTF <= anchorPrice)
if (currentLeftMTF <= clickTime && currentRightMTF >= clickTime)
{
if (myList[index].type == BULL)
showMTF = -1;
if (myList[index].type == BEAR)
showMTF = 1;
Print(anchorPrice + " " + clickTime + " " + myList[index].heightT + " " + showMTF);
}
}
}
}
It runs fine. But when I first load the indicator, there is a single Print line. If I press F5 on the chart to reload the indicator, I get 2 Print lines when I click. If I press F5 again I get 3 Print lines. then 4, then 5. If I remove the indicator and reload it, it goes back to 1 Print line.
here is the output window
This seems like odd behavior so I want to make sure I'm not screwing up something else.
. What is causing it?


Comment