I need the OHLC prices to calculate VWAP and to anchor the drawing tool to the VWAP value of that bar
Here is my code for my OneMouseDown() method:
public override void OnMouseDown(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint) { switch (DrawingState) { case DrawingState.Building: if (StartAnchor.IsEditing) // if this is the first click on the chart { dataPoint.CopyDataValues(StartAnchor); // Set the StartAnchor's time and price to the mouse click StartAnchor.IsEditing = false; // Marks the start anchor is placed double doublebarNumber = StartAnchor.SlotIndex; // Get the bar index of the click int barNumber = (int)Math.Round(doublebarNumber); // Convert it to an int cause its a double even though its a whole number Print("Bar # Clicked on: " + barNumber); // Get the low of barNumber (stuck here) //double barLow = ChartBars.Bars.GetLow(barNumber); // Error double barLow = Bars.GetLow(barNumber); // Error "An object reference is required for the non-static field method or property 'Bars.GetLow(int)'" Print("Clicked BarLow: " + barLow); } break; } }
Anyone have a solution? I'm sure someone has done this before.
Comment