In this article, you will learn more about creating and using Coloring Strategies through the Language Editor. This is one of our five articles about different types of strategies that can be created. Click here to access an introductory article.
Coloring Strategies
Coloring strategies are also called Paint Bars. When your strategy has the PaintBar(Cor: Integer) function, it can be used as a Paint Bar, as long as it’s added to one of your charts or even specific indicators.
Besides, there is the function SetPlotColor(Plot: Integer, Cor: Integer. This one doesn’t define the strategy as a Coloring Strategy but does define that the line of your Indicator Strategy (which has been defined in the equivalent number’s Plot to the “Plot” parameter) will be colored with the Color parameter. These rules’ execution happens in real-time according to the asset’s price update. Keep in mind that the market has to be opened.
Example:
begin
Plot(Close);
Plot2(High);
SetPlotColor(1, ClRed);
SetPlotColor(2, ClWhite);
end;
The code above shows that two different lines will be plotted, one for each candle’s closing and another for the Maximum. The closing line will be colored in red, and the maximum line, in white.
A Coloring Strategy to color the candles if the RSI with an interval set for 10 is overbuying or overselling would be, for example:
begin
if(IFR(10) > 70) then
PaintBar(ClGreen)
else if(IFR(10) < 30) then
PaintBar(ClRed);
Plot(IFR(10));
end;
The Plot at the end of the strategy is merely illustrative, to view the RSI(10) in the image.
To add a Coloring Strategy (or Bar), right-click the chart, select “Add Paint Bar” and select the name of the Strategy you have created. It’s worth mentioning that Paint Bars can be added to one Indicator at a time, allowing different indicators to have different colors.
To read about the other four types of strategies, access the links below:
For further info about the functions mentioned above, read the following content by our partner Nelogica (available in Brazilian Portuguese). The document has a downloadable PDF file with the tool’s functions at the end of the text: Strategies Module.
We also recommend watching the introductory playlist about the module. To do so, click here (Available in Brazilian Portuguese).
Hey! Was this content helpful?
Please rate it below! It's important that we work together to make our Help Center even more complete.
Happy trading!
Comments
0 comments
Article is closed for comments.