Support Board
Date/Time: Fri, 31 Jan 2025 06:02:11 +0000
[Programming Help] - Percentile Rank in ACSIL
View Count: 867
[2019-04-11 17:56:32] |
User312162 - Posts: 40 |
Is there a way to call the PercentRank formula from excel into ACSIL. I tried to use the Stochastic-Percentile example but I cannot change the Input Data from the BaseData to the study I need to use Percentile on. Here is the example: I want to use the percentile on the "Mag_Sum" formula but I can only pick from the default (Open, High, Low, Close, etc) in the input data. Mag_Sum[sc.Index] = sc.GetSummation(Mag, SumLength.GetInt()); std::vector<float> AscendingValues; SCFloatArrayRef DataArray = sc.BaseData[InputData.GetInputDataIndex()]; sc.DataStartIndex = PRLength.GetInt() - 1; for (int CurrentIndex = sc.UpdateStartIndex; CurrentIndex < sc.ArraySize; CurrentIndex++) { AscendingValues.clear(); int FirstIndex = CurrentIndex - PRLength.GetInt() + 1; for (int BarIndex = FirstIndex; BarIndex <= CurrentIndex; BarIndex++) { AscendingValues.push_back(DataArray[BarIndex]); } std::sort(AscendingValues.begin(), AscendingValues.end()); float CurrentPrice = DataArray[CurrentIndex]; int AscendingValuesSize = static_cast<int>(AscendingValues.size()); int AscendingValuesIndex = 0; for (; AscendingValuesIndex < AscendingValuesSize; AscendingValuesIndex++) { if (CurrentPrice == AscendingValues[AscendingValuesIndex]) break; if (AscendingValuesIndex == AscendingValuesSize - 1) break; } ACPR[CurrentIndex] = 1.0f * AscendingValuesIndex / (PRLength.GetInt() - 1); |
To post a message in this thread, you need to log in with your Sierra Chart account: