Support Board
Date/Time: Wed, 12 Feb 2025 07:26:55 +0000
Post From: sc.RangeBarValue
[2020-10-07 14:22:57] |
Ackin - Posts: 1865 |
sc.RangeBarValue This ACSIL structure member is considered out of date/deprecated. Instead use the sc.GetBarPeriodParameters and sc.SetBarPeriodParameters functions. sc.GetBarPeriodParameters sc.GetBarPeriodParameters() sc.SetBarPeriodParameters sc.SetBarPeriodParameters() ******************************************************************** CCIPredictor Example (from Studies4.cpp ACS folder in your Sierrachart): Old code SCSFExport scsf_CCIPredictor(SCStudyInterfaceRef sc) { SCSubgraphRef CCIProjHigh = sc.Subgraph[0]; SCSubgraphRef CCIProjLow = sc.Subgraph[1]; SCSubgraphRef CCIOutputHigh = sc.Subgraph[2]; SCSubgraphRef CCIOutputLow = sc.Subgraph[3]; SCInputRef CCILength = sc.Input[0]; if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "CCI Predictor"; sc.AutoLoop = 1; sc.GraphRegion = 1; CCIProjHigh.Name = "CCI Proj High"; CCIProjHigh.DrawStyle = DRAWSTYLE_ARROWDOWN; CCIProjHigh.PrimaryColor = RGB(255,255,255); CCIProjHigh.LineWidth = 3; CCIProjHigh.DrawZeros = false; CCIProjLow.Name = "CCI Proj Low"; CCIProjLow.DrawStyle = DRAWSTYLE_ARROWUP; CCIProjLow.PrimaryColor = RGB(255,255,255); CCIProjLow.LineWidth = 3; CCIProjLow.DrawZeros = false; CCILength.Name = "CCI Length"; CCILength.SetInt(14); return; } //CCI High CCIProjHigh.Arrays[0][sc.Index] = sc.HLCAvg[sc.Index]; if (sc.Index == sc.ArraySize - 1 && sc.AreRangeBars()) { float ProjectedRangeHigh=sc.Low[sc.Index]+sc.RangeBarValue; CCIProjHigh.Arrays[0][sc.Index] = ( ProjectedRangeHigh + ProjectedRangeHigh +sc.Low[sc.Index])/3; } sc.CCI(CCIProjHigh.Arrays[0], CCIOutputHigh, sc.Index, CCILength.GetInt(), 0.015f); if (sc.Index == sc.ArraySize - 1) CCIProjHigh[sc.Index] = CCIOutputHigh[sc.Index]; else CCIProjHigh[sc.Index] = 0; //CCI Low CCIProjLow.Arrays[0][sc.Index] = sc.HLCAvg[sc.Index]; if (sc.Index == sc.ArraySize - 1 && sc.AreRangeBars()) { float ProjectedRangeLow=sc.High[sc.Index]-sc.RangeBarValue; CCIProjLow.Arrays[0][sc.Index] = ( ProjectedRangeLow + ProjectedRangeLow +sc.High[sc.Index])/3; } sc.CCI(CCIProjLow.Arrays[0], CCIOutputLow, sc.Index, CCILength.GetInt(), 0.015f); if (sc.Index == sc.ArraySize - 1) CCIProjLow[sc.Index] = CCIOutputLow[sc.Index]; else CCIProjLow[sc.Index] = 0; } New code SCSFExport scsf_CCIPredictor(SCStudyInterfaceRef sc) { SCSubgraphRef CCIProjHigh = sc.Subgraph[0]; SCSubgraphRef CCIProjLow = sc.Subgraph[1]; SCSubgraphRef CCIOutputHigh = sc.Subgraph[2]; SCSubgraphRef CCIOutputLow = sc.Subgraph[3]; SCInputRef CCILength = sc.Input[0]; if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "CCI Predictor"; sc.AutoLoop = 0; sc.GraphRegion = 1; CCIProjHigh.Name = "CCI Proj High"; CCIProjHigh.DrawStyle = DRAWSTYLE_ARROW_DOWN; CCIProjHigh.PrimaryColor = RGB(255,255,255); CCIProjHigh.LineWidth = 3; CCIProjHigh.DrawZeros = false; CCIProjLow.Name = "CCI Proj Low"; CCIProjLow.DrawStyle = DRAWSTYLE_ARROW_UP; CCIProjLow.PrimaryColor = RGB(255,255,255); CCIProjLow.LineWidth = 3; CCIProjLow.DrawZeros = false; CCILength.Name = "CCI Length"; CCILength.SetInt(14); return; } n_ACSIL::s_BarPeriod BarPeriod; sc.GetBarPeriodParameters(BarPeriod); for(int BarIndex = sc.UpdateStartIndex; BarIndex < sc.ArraySize; BarIndex++) { //CCI High CCIProjHigh.Arrays[0][BarIndex] = sc.HLCAvg[BarIndex]; if (BarIndex == sc.ArraySize - 1 && BarPeriod.AreRangeBars()) { float ProjectedRangeHigh = sc.Low[BarIndex] + BarPeriod.IntradayChartBarPeriodParameter1; CCIProjHigh.Arrays[0][BarIndex] = (ProjectedRangeHigh + ProjectedRangeHigh + sc.Low[BarIndex]) / 3; } sc.CCI(CCIProjHigh.Arrays[0], CCIOutputHigh, BarIndex, CCILength.GetInt(), 0.015f); if (BarIndex == sc.ArraySize - 1) CCIProjHigh[BarIndex] = CCIOutputHigh[BarIndex]; else CCIProjHigh[BarIndex] = 0; //CCI Low CCIProjLow.Arrays[0][BarIndex] = sc.HLCAvg[BarIndex]; if (BarIndex == sc.ArraySize - 1 && BarPeriod.AreRangeBars()) { float ProjectedRangeLow = sc.High[BarIndex] - BarPeriod.IntradayChartBarPeriodParameter1; CCIProjLow.Arrays[0][BarIndex] = (ProjectedRangeLow + ProjectedRangeLow + sc.High[BarIndex]) / 3; } sc.CCI(CCIProjLow.Arrays[0], CCIOutputLow, BarIndex, CCILength.GetInt(), 0.015f); if (BarIndex == sc.ArraySize - 1) CCIProjLow[BarIndex] = CCIOutputLow[BarIndex]; else CCIProjLow[BarIndex] = 0; } } |