Support Board
Date/Time: Wed, 05 Feb 2025 16:53:42 +0000
Coloring Indicator area C++ option
View Count: 161
[2025-01-07 11:46:01] |
MTScalper - Posts: 14 |
Hi. I'm try to create an indicator where I need to color areas above certain levels of the indicator, as shown in the picture. Currently, I'm using the Brush functionality, but it makes the indicator heavier because it continuously draws lines to cover the entire area. I was wondering if there are other compatible Windows or C++ libraries to improve this aspect and also have the possibility to set transparency levels with fading within these colored areas. I'm not sure if I explained myself clearly; I hope I was thorough enough. Code example // Drw the areas if (!OverboughtPoints.empty()) { // Alpha Brush (requires correction on transparency level) BYTE alpha = (BYTE)(255 * (100 - OverboughtTransparency) / 100); COLORREF color = RGB( (GetRValue(OverboughtColor) * alpha) / 255, (GetGValue(OverboughtColor) * alpha) / 255, (GetBValue(OverboughtColor) * alpha) / 255 ); HBRUSH hBrush = CreateSolidBrush(color); HBRUSH hOldBrush = (HBRUSH)SelectObject(DeviceContext, hBrush); // Drw the polygon on areas (need to improve) Polygon(DeviceContext, OverboughtPoints.data(), static_cast<int>(OverboughtPoints.size())); // Clean (need some correction) SelectObject(DeviceContext, hOldBrush); DeleteObject(hBrush); } Date Time Of Last Edit: 2025-01-08 14:01:34
|
[2025-01-07 13:05:51] |
User431178 - Posts: 579 |
Is there a reason you can't use the built-in fill top/bottom pairs in you study to achieve that same effect? Chart Studies: Filling the Area Between Two Study Subgraphs within Same Study |
[2025-01-08 09:04:47] |
MTScalper - Posts: 14 |
Thank you so much for the suggestion! So, in this case, I should rewrite the settings for the overbought and oversold lines as indicators and not as draw-lines, correct?
|
[2025-01-08 10:25:15] |
User431178 - Posts: 579 |
I should rewrite the settings for the overbought and oversold lines as indicators and not as draw-lines, correct?
Can't really answer fully without more context.You can add the fill top/bottom subgraphs in addition to lines, or instead of. |
[2025-01-08 14:01:14] |
MTScalper - Posts: 14 |
Okay, I’ll try to modify it. In the meantime, I want to thank you for the advice and the time you dedicated to answering. Thanks again!
|
To post a message in this thread, you need to log in with your Sierra Chart account: