Support Board
Date/Time: Sun, 08 Sep 2024 01:52:40 +0000
"For" Loop to find the lowest price in an array of bars on a chart
View Count: 1368
[2015-09-17 22:45:31] |
User126996 - Posts: 30 |
I'm trying to find the lowest price in an array of bars on the chart. I'm using a pointer that is in the SCInputRef to determine how many bars or indices to look back. if (sc.SetDefaults) { PivotLength.Name = "Pivot Length"; PivotLength.SetInt(5); PivotLength.SetIntLimits(1, MAX_STUDY_LENGTH); return; } SCDateTime LowDT; int Arr[] = { sc.BaseData[SC_LOW][sc.Index - PivotLength.GetInt()] }; int i; int Low = Arr[0]; for (i = 0; i >= sc.BaseData[SC_LOW][sc.Index - PivotLength.GetInt()]; i++) { if (Arr[i] < Low) { Arr[i] = Low; Low = Arr[i]; LowDT = sc.BaseDateTimeIn[sc.Index - PivotLength.GetInt()]; } } Can you give some advice to where I'm going wrong? I'm new to the platform. It's quality though! |
[2015-09-18 01:10:40] |
ejtrader - Posts: 688 |
Probably built-in sc functions might be better for what you are trying to do unless you wanted a custom version of it. sc.GetLowest() sc.GetIndexOfLowestValue() |
[2015-09-19 10:33:53] |
|
The answer given in post #2 is the same answer we would have given.
Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2015-09-23 00:02:57] |
User126996 - Posts: 30 |
ejtrader and Sierra Chart support thanks for the help! I didn't initially see the sc function.
|
To post a message in this thread, you need to log in with your Sierra Chart account: