Discussion of article "Canvas based indicators: Filling channels with transparency"

 

New article Canvas based indicators: Filling channels with transparency has been published:

In this article I'll introduce a method for creating custom indicators whose drawings are made using the class CCanvas from standard library and see charts properties for coordinates conversion. I'll approach specially indicators which need to fill the area between two lines using transparency.

Now we will make some small updates to get it working.

  1. Update our Redraw function, removing the parameters that was added in prior indicator and adding the DrawFilling function.
  2. Add our Redraw function in the OnCalculation, to update the drawing when the indicator values change.
  3. Change the object name passed as parameter when calling CreateBitmapLabel.

And that is done. You can see how it looks now with two Envelopes with different periods and one rectangle object.

Envelopes using CCanvas with alpha = 128

Author: Samuel Manoel De Souza

 

Great job Samuel!

But I saw a situation here: using it in my indicator, every time the PRICES axis re-scales, we see that CANVAS does not update itself.

See the images:


and here, after I resize manually the window and everything had been fixed automatically, when the current candle crossed the bounds the chart causing a complete re-scaling of candles, the CANVAS did not re-scale again, as it should:




Also, I can see that the DrawFilling function consumes a lot of time if we use it twice, I mean, to plot 2 colors among three lines (see above). I guess it would be interesting if we could optimize the routine for speed.

Anyway, great job and article - congrats!