Support Board
Date/Time: Mon, 08 Sep 2025 16:30:24 +0000
Post From: Is it possible to hide/show a study on alert condition? Volume Point of Control for Bars
[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
|
![]() |