Support Board
Date/Time: Sun, 24 Nov 2024 06:58:37 +0000
Post From: inv reference type question
[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; } |