Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 06:49:02 +0000



[Programming Help] - sc.Highest needs 4 arguments to work in manual loop but compiler says expects 3

View Count: 550

[2021-04-21 09:42:48]
User785302 - Posts: 8
Hello

The following code does not compile.

Error:
- Starting remote build of Custom Studies Source files: ScratchPad.cpp. 64-bit -- 04:36:10

Allow time for the server to compile the files and build the DLL.

The remote build did not succeed. Result:

ScratchPad.cpp: In function 'void scsf_GetHighest(SCStudyInterfaceRef)':
ScratchPad.cpp:32:60: error: no matching function for call to 's_sc::Highest(c_ArrayWrapper<float>&, float&, int&, int)'
32 | sc.Highest(Sg_BB.Arrays[0], Sg_Highest[Index], Index, 10);
| ^
In file included from ScratchPad.cpp:6:
sierrachart.h:787:18: note: candidate: 'c_ArrayWrapper<float>& s_sc::Highest(SCFloatArrayRef, SCFloatArrayRef, int, int)'
787 | SCFloatArrayRef Highest(SCFloatArrayRef In, SCFloatArrayRef Out, int Index, int Length)
| ^~~~~~~
sierrachart.h:787:62: note: no known conversion for argument 2 from 'float' to 'SCFloatArrayRef' {aka 'c_ArrayWrapper<float>&'}
787 | SCFloatArrayRef Highest(SCFloatArrayRef In, SCFloatArrayRef Out, int Index, int Length)
| ~~~~~~~~~~~~~~~~^~~
sierrachart.h:792:18: note: candidate: 'c_ArrayWrapper<float>& s_sc::Highest(SCFloatArrayRef, SCFloatArrayRef, int)'
792 | SCFloatArrayRef Highest(SCFloatArrayRef In, SCFloatArrayRef Out, int Length)
| ^~~~~~~
sierrachart.h:792:18: note: candidate expects 3 arguments, 4 provided

-- End of Build -- 04:36:13

Here is my SCSF code:

SCSFExport scsf_GetHighest(SCStudyInterfaceRef sc) {
  SCSubgraphRef Sg_BB = sc.Subgraph[0];
  SCSubgraphRef Sg_Highest = sc.Subgraph[1];
  if (sc.SetDefaults) {
    sc.GraphName = "Testing Highest";
    sc.GraphRegion = 0;
    Sg_BB.Name = "BB";
    Sg_Highest.Name = "Highest";
    return;
  }

  for (int Index = sc.UpdateStartIndex; Index < sc.ArraySize; ++Index)
  {
    sc.BollingerBands(sc.BaseData[SC_LAST], Sg_BB, Index, 10, 2, MOVAVGTYPE_SIMPLE);
    sc.Highest(Sg_BB.Arrays[0], Sg_Highest[Index], Index, 10);
  }
}

Regards
[2021-04-21 16:41:28]
Sierra Chart Engineering - Posts: 104368
You need to correct this line as follows:
sc.Highest(Sg_BB.Arrays[0], Sg_Highest, Index, 10);

The result will go into Sg_Highest at the element at Index.
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

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account