Login Page - Create Account

Support Board


Date/Time: Sun, 07 Sep 2025 19:13:37 +0000



[Programming Help] - Is it possible to hide/show a study on alert condition? Volume Point of Control for Bars

View Count: 119

[2025-08-28 22:19:56]
artmaan - Posts: 27
Hi,

i would like to see the "Volume Point of Control for Bars" study only for specific bars. if for example the volume is above 1000 for a bar, than it should show the "Volume Point of Control for Bars".

i know i could use "colour bar based on alert condition"and mark the bar, but i would like to see the location of the "Volume Point of Control for Bars" on this bar.

thx
[2025-08-29 02:20:48]
D.Vicious - Posts: 24
Made this one back in the day...should do what your asking.

#include "sierrachart.h"

SCDLLName("VolumePointOfControlForBars+")

SCSFExport scsf_VolumePointOfControlForBars(SCStudyInterfaceRef sc)
{
SCSubgraphRef Subgraph_VPOC = sc.Subgraph[0];
s_SCInput_145& In_MaxBarVolume = sc.Input[0];

if (sc.SetDefaults)
{
sc.GraphName = "Volume Point of Control for Bars+";
sc.AutoLoop = 0;
sc.MaintainVolumeAtPriceData = true;
sc.GraphRegion = 0;

Subgraph_VPOC.Name = "VPOC";
Subgraph_VPOC.DrawStyle = DRAWSTYLE_SQUARE_OFFSET_LEFT_FOR_CANDLESTICK;
Subgraph_VPOC.LineWidth = 8;
Subgraph_VPOC.PrimaryColor = RGB(255, 128, 0);
Subgraph_VPOC.DrawZeros = 0; // IMPORTANT: 0-value hides the marker

In_MaxBarVolume.Name = "Max Bar Total Volume to Show VPOC (0 = No Limit)";
In_MaxBarVolume.SetFloat(0.0f);

return;
}

const double maxBarVol = In_MaxBarVolume.GetFloat();

// Do data processing
for (int BarIndex = sc.UpdateStartIndex; BarIndex < sc.ArraySize; ++BarIndex)
{
// If limit is set (>0) and this bar's total volume exceeds it, hide VPOC
const double barVol = sc.Volume[BarIndex];
if (maxBarVol > 0.0 && barVol > maxBarVol)
{
Subgraph_VPOC[BarIndex] = 0.0f; // hidden due to DrawZeros=0
continue;
}

s_VolumeAtPriceV2 VAP;
sc.GetPointOfControlPriceVolumeForBar(BarIndex, VAP);

if (VAP.PriceInTicks != 0)
{
Subgraph_VPOC[BarIndex] = static_cast<float>(sc.TicksToPriceValue(VAP.PriceInTicks));
}
else
{
// No POC found: ensure we don't leave stale values
Subgraph_VPOC[BarIndex] = 0.0f; // hidden
}
}
}

Date Time Of Last Edit: 2025-08-29 02:21:35
attachmentVPOCFP_64.dll - Attached On 2025-08-29 02:20:28 UTC - Size: 886.5 KB - 14 views
[2025-08-29 21:30:13]
John - SC Support - Posts: 41652
To do this using the built-in tools, you would need to use the "Color Bar Based on Alert Condition" and have the condition occur where you do NOT want to see the Point of Control, then use the "Color Bar Based on Alert Condition" to draw over the ones you do not want to see using a color that would match your background. Refer to the following:
Color Bar Based on Alert Condition
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account