I have a piece of code in onbarUpdate() including a boolean. The idea is to save the bool value in OnBarUpdate() and to call it in OnRender() to draw a rectangle. The problem is that the conmpilation goes well, but when I attach the indicator on the chart, the rectangle is not drown. To check if the function works, I have replaced the boolean in OnBarUpdate() by Draw.Arrow() and I have the arrows on the chart. OnRender() is not involved for drawing arrows. Here is the piece of code:
private bool flagUp = false; protected override void OnBarUpdate() { if(myFastEMACrossesAbovemySlowEMA) { flagUp = true; } else if(myFastEMACrossesBelowmySlowEMA) { flagUp = false; } }
protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { if (IsInHitTest) return; else base.OnRender(chartControl, chartScale); if(flagUp = true) { RenderTarget.FillRectangle(rect, UpColorBrushDx); } }
Many thanks in advance!
Comment