Using markers with indicators
Mark some specific point or set of points on indicator's line
Last updated
Mark some specific point or set of points on indicator's line
Last updated
During indicators development, you may need to mark some specific point or set of points on indicator's line. For example, you want to mark the place, where two lines are crossing or place, where your algorithm find some bar pattern. Yes, you can use GDI+ drawings and OnPaintChart method, as we've shown in our previous topic, but Quantower API provides a more simple way to accomplish this.
Each indicator line contains method SetMarker, which allows you to assign some special style for the particular element in your indicator's line buffer. The most simple way is marking it via a specified color. This is an example of usage:
We colored in yellow each tenth bar:
Another way of marking is using icons. You can specify a type of icon, it's position and color. You can use the same overridden method SetMarker:
Result is displayed on the chart:
Let's create a little more useful indicator. For example - we will mark with a green up arrow, places where we have more than 5 growing candles in a row and mark with a red bottom arrow, in the case of 5 falling bars. This is source code implementing this logic:
And its visualization:
Using SetMarker functions you can simply mark important moments on your indicator. We are going to extend markers possibilities: add more new icons, add text and custom painting. And remember - you can always propose us your own ideas.