Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 04:06:32 +0000



inv reference type question

View Count: 1640

[2013-09-17 15:43:09]
gabby alindogan - Posts: 49
Hi Trying to pick the highest hi for past 10 bars with a 1 bar offset. This means current bar's value would be highest high of the past 10 bars starting with the bar to the left. I tried creating array "PrevHi" to load high 1 bar back then use gethighest function on it. Can you please tell me my error using this code? The DLL error I am getting is

Starting build of Custom Studies Source File: Fx.cpp. -- 11:34:43
"C:\SierraChart\CPPCompiler\bin\g++.exe" "C:\SierraChart\ACS_Source\Fx.cpp" -march=i686 -mtune=i686 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions -o "C:\SierraChart\Data\Fx.dll"

C:\SierraChart\ACS_Source\Fx.cpp: In function 'void scsf_CapPoints(SCStudyInterfaceRef)':
C:\SierraChart\ACS_Source\Fx.cpp:42:60: error: invalid initialization of reference of type 'SCFloatArrayRef {aka c_ArrayWrapper<float>&}' from expression of type 'float'
SCFloatArrayRef PrevHi = sc.BaseData[SC_HIGH][sc.Index-1 ];
^
-- End of Build -- 11:34:44

SCSFExport scsf_CapPoints(SCStudyInterfaceRef sc)
{
  
  if (sc.SetDefaults)
  {
    sc.GraphName = "Capitulation Points " ;
    sc.Subgraph[0].Name = "Cap Points (20D)> ";
    sc.AutoLoop=1;
    sc.FreeDLL = 1;
    return;
  }
    SCFloatArrayRef PrevHi = sc.BaseData[SC_HIGH][sc.Index-1 ];
    float HighestxBB = sc.GetHighest(PrevHi, 10);
    10 barssc.Subgraph[0][sc.Index] =HighestxBB;
     return;
}

SCSFExport scsf_CapPoints(SCStudyInterfaceRef sc)
{
  // Section 1 - Set the configuration variables
  
  if (sc.SetDefaults)
  {
    sc.GraphName = "Capitulation Points " ;
    sc.Subgraph[0].Name = "Cap Points (20D)> ";
    sc.AutoLoop=1;
    sc.FreeDLL = 1;
    return;
  }
    SCFloatArrayRef PrevHi = sc.BaseData[SC_HIGH][sc.Index-1 ];
    float HighestxBB = sc.GetHighest(PrevHi, 10);
    sc.Subgraph[0][sc.Index] =HighestxBB;
     return;
}
[2013-09-17 19:21:25]
Sierra Chart Engineering - Posts: 104368

float HighestxBB = sc.GetHighest(sc.BaseData[SC_HIGH], 10);

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
[2013-09-17 19:42:12]
gabby alindogan - Posts: 49
The code you detailed plots the highest high past 10 days BUT does not offset by 1 bar i.e. sc.index-1. The indicator needs to plot the highest high past 10 bars excluding the current bar which is still in process of completing.

I tried to change your line by adding an offset and I got errors.

Orig> float HighestxBB = sc.GetHighest(sc.BaseData[SC_HIGH], 10);

Changed to > float HighestxBB = sc.GetHighest(sc.BaseData[SC_HIGH][sc.Index-1], 10);

Error log follows

C:\SierraChart\ACS_Source\Fx.cpp: In function 'void scsf_CapPoints(SCStudyInterfaceRef)':
C:\SierraChart\ACS_Source\Fx.cpp:47:72: error: no matching function for call to 's_sc::GetHighest(float&, int)'
float HighestxBB = sc.GetHighest(sc.BaseData[SC_HIGH][sc.Index-1], 10);
^
C:\SierraChart\ACS_Source\Fx.cpp:47:72: note: candidates are:
In file included from C:\SierraChart\ACS_Source\Fx.cpp:2:0:
C:\SierraChart\ACS_Source\sierrachart.h:3008:8: note: float s_sc::GetHighest(SCFloatArrayRef, int, int)
float GetHighest(SCFloatArrayRef In, int Index, int Length)
^
C:\SierraChart\ACS_Source\sierrachart.h:3008:8: note: candidate expects 3 arguments, 2 provided
C:\SierraChart\ACS_Source\sierrachart.h:3025:8: note: float s_sc::GetHighest(SCFloatArrayRef, int)
float GetHighest(SCFloatArrayRef In, int Length)
^
C:\SierraChart\ACS_Source\sierrachart.h:3025:8: note: no known conversion for argument 1 from 'float' to 'SCFloatArrayRef {aka c_ArrayWrapper<float>&}'
-- End of Build -- 15:39:54

[2013-09-19 01:50:02]
Sierra Chart Engineering - Posts: 104368
We really have limited time with to help with this. We recommend contacting Onn here:
https://www.sierrachart.com/index.php?l=doc/SierraChartStudyAndSystemProgrammers.html#ThirdPartyList

Also, the easiest way to accomplish an offset is by using the Displacement setting on the Study Subgraph in the Study Settings window for the study.
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
Date Time Of Last Edit: 2013-09-19 01:51:53
[2013-09-19 01:55:10]
Sierra Chart Engineering - Posts: 104368
This is what you want to use:

float HighestxBB = sc.GetHighest(sc.BaseData[SC_HIGH],sc.Index-1, 10);
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