Login Page - Create Account

Support Board


Date/Time: Thu, 13 Mar 2025 02:07:04 +0000



Post From: Same values repeated on all bars (should not)

[2022-05-30 17:33:52]
BenjFlame - Posts: 335
Hello,
here is a calculation of delta. I know it's build-in in sierra but I will need to code it.


SCSubgraphRef SubGraph_NQ_Volume_Delta = sc.Subgraph[1];


if (sc.SetDefaults)
{

sc.MaintainAdditionalChartDataArrays = 1;

sc.CalculationPrecedence = LOW_PREC_LEVEL;

// Set the defaults
sc.GraphName = "INSTRUMENTS FLOW";

sc.GraphRegion = 0;
sc.ScaleRangeType = SCALE_SAMEASREGION;

SubGraph_NQ_Volume_Delta.Name = "NQ volume delta";
SubGraph_NQ_Volume_Delta.DrawStyle = DRAWSTYLE_TEXT;
SubGraph_NQ_Volume_Delta.PrimaryColor = RGB(255, 255, 255);
SubGraph_NQ_Volume_Delta.LineWidth = 12;

sc.AutoLoop = 1;

return;
}



float NqDelta = sc.BaseData[SC_ASKVOL][sc.Index] - sc.BaseData[SC_BIDVOL][sc.Index];

SCString NqDeltaText;
NqDeltaText.Format("%.0f", NqDelta);
SubGraph_NQ_Volume_Delta.TextDrawStyleText = NqDeltaText;
SubGraph_NQ_Volume_Delta[sc.Index] = sc.Close[sc.Index] - 1;
}

That code displays the delta from last bar (which is correct) but under ALL the previous bars also, instead of each bar's value under it. Where is the mistake?