Support Board
Date/Time: Sun, 23 Feb 2025 18:38:43 +0000
[Programming Help] - Max/Min of more than 2 ScFloatArrays
View Count: 831
[2021-02-18 17:15:02] |
Nick_ON_CAD - Posts: 22 |
Could someone please point me in right direction? Would be greatly appreciated. Subgraph_PriceOverlayMax[BarIndex] = max(Study1Array[BarIndex], Study2Array[BarIndex], Study3Array[BarIndex], Study4Array[BarIndex], Study5Array[BarIndex], Study6Array[BarIndex], Study7Array[BarIndex]); This is what I'm trying to accomplish but I realize that max() only takes two parameters. I want a reference to the highest/lowest subgraph. What is the preferred way to find min/max of a >2 arrays, in ACSIL? Most of my experience is in Python and having a hard time finding an example in any of the SC code - tried to use std:max() with initializer list but won't compile. Thank you, Nick |
[2021-02-19 00:07:25] |
norvik_ - Posts: 106 |
std::vector<float>values{Study1Array[BarIndex], Study2Array[BarIndex], Study3Array[BarIndex], Study4Array[BarIndex], Study5Array[BarIndex], Study6Array[BarIndex], Study7Array[BarIndex]};
auto result = std::max_elemnt(values.begin(),values.end()); float max_value = *result; Don't forget #include<algorithm> :) Date Time Of Last Edit: 2021-02-19 00:09:34
|
[2021-02-19 15:25:18] |
ForgivingComputers.com - Posts: 1012 |
What is the preferred way to find min/max of a >2 arrays, in ACSIL?
As you noted, max(a,b) takes only two parameters. You can nest max statements: 3 parameters: a, b, c max(a,max(b,c))
4 parameters: a, b, c, d max(a,max(b,max(c,d)))
etc. |
To post a message in this thread, you need to log in with your Sierra Chart account: