Support Board
Date/Time: Fri, 07 Feb 2025 04:36:48 +0000
[Programming Help] - GetIndexOfLowestValue
View Count: 1010
[2020-05-22 20:46:23] |
anahnemuss - Posts: 1 |
Hello, I'm working on an indicator running into a problem with sc.GetIndexOfLowestValue using the following code: int Lookback = I_Lookback.GetInt(); float CCILongLowest = sc.GetLowest(CCI, Lookback); // find lowest point in the lookback period int CCILongLowestBar = sc.GetIndexOfLowestValue(CCI, Lookback); // find index of lowest bar in the lookback period float CCILongHighest = sc.GetHighest(CCI, CCILongLowestBar); // find highest point since the lowest bar was found int CCILongHighestBar = sc.GetIndexOfHighestValue(CCI, CCILongLowestBar); // find index of highest bar since lowest value found float CCILongWaveRange = CCILongHighest - CCILongLowest; // find the range of the wave up I'm trying to find the value and index of recent high and low values for CCI (Lookback = 20 in this case). When I push these vars out to the log to debug, the GetLowest function works correctly, but the rest of these are returning results from the entire dataset. I've searched a lot on here and the docs, and looked at the code examples to see what I'm missing, but I'm coming up short. Additionally, is there any way to tell sc.GetIndexOfLowestValue to search 20 bars back but exclude the current bar? Thanks! |
[2020-05-23 04:04:13] |
Flipper - Posts: 65 |
Additionally, is there any way to tell sc.GetIndexOfLowestValue to search 20 bars back but exclude the current bar?
from here sc.GetIndexOfLowestValue()float GetIndexOfLowestValue(SCFloatArrayRef FloatArrayIn, int Index, int Length);
float GetIndexOfLowestValue(SCFloatArrayRef FloatArrayIn, int Length); Auto-looping only. First one has a start index so if you do sc.Index - 1 that will be what you want. As to the first problem. No idea without see all the code. The function works fine for me though. |
To post a message in this thread, you need to log in with your Sierra Chart account: