Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 04:24:39 +0000



[User Discussion] - Wierd error on modified code

View Count: 1047

[2015-10-14 04:29:32]
KhaosTrader - Posts: 128
Hi,

I modified the ADX DMI code such that I can put some horizontal lines in the subchart, but I am getting an error saying :


-- Starting build of Custom Studies Source files: Jeff1.cpp. -- 00:22:34

"C:\SierraChart\CPPCompiler\bin\g++.exe" "C:\JeffData\Dropbox\!!!SierraChart - Code Dev\SierraChart\ACS_Source\Jeff1.cpp" -march=i686 -mtune=i686 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions -std=gnu++11 -o "C:\JeffData\Dropbox\!!!SierraChart - Code Dev\SierraChart\Data\Jeff1.dll"

C:\JeffData\Dropbox\!!!SierraChart - Code Dev\SierraChart\ACS_Source\Jeff1.cpp: In function 'void scsf_BAO_ADX_DMI(SCStudyInterfaceRef)':
C:\JeffData\Dropbox\!!!SierraChart - Code Dev\SierraChart\ACS_Source\Jeff1.cpp:1396:5: error: 'struct s_sc' has no member named 'LineVal1'
sc.LineVal1[sc.Index]=15;
^
-- End of Build -- 00:22:35


as a side note, I also noticed that the following inputs start with index 3...


  SCInputRef Length = sc.Input[3];
  SCInputRef MALength = sc.Input[4];
  SCInputRef ADXRInterval = sc.Input[5];

I made changes to it making it start from 0, rather than 3, and that didn't work on the example, as no inputs were received.. so it all values were 0...

Anyway, here is my modified code, I don't know why I am getting errors in compiling..


SCSFExport scsf_BAO_ADX_DMI(SCStudyInterfaceRef sc)
{
  SCSubgraphRef DmiPlus = sc.Subgraph[0];
  SCSubgraphRef DmiMinus = sc.Subgraph[1];
  SCSubgraphRef ADX = sc.Subgraph[2];
  SCSubgraphRef ADXR = sc.Subgraph[3];
  
  SCSubgraphRef LineVal1 = sc.Subgraph[8];
  //SCSubgraphRef LineVal_2 = sc.Subgraph[5];
  //SCSubgraphRef LineVal_3 = sc.Subgraph[6];
  //SCSubgraphRef LineVal_4 = sc.Subgraph[7];
  //SCSubgraphRef LineVal_5 = sc.Subgraph[8];
  

  SCInputRef Length = sc.Input[3];
  SCInputRef MALength = sc.Input[4];
  SCInputRef ADXRInterval = sc.Input[5];


  
  
if (sc.SetDefaults)
{
// Set the configuration and defaults

sc.GraphName = "BAO DMI & ADX & ADXR";

sc.StudyDescription = "DMI: Welles Wilder's Plus and Minus Directional Indicators +DI and -DI.\n "
"ADX: Average Directional Movement Index. This is calculated according to the Welles Wilder formulas.\n"
"ADXR: Average Directional Movement Index Rating. This is calculated according to the Welles Wilder formulas.";

sc.AutoLoop = 1; // true



DmiPlus.Name = "DI+";
DmiPlus.DrawStyle = DRAWSTYLE_LINE;
    DmiPlus.PrimaryColor = RGB(0,255,0);
    DmiPlus.DrawZeros = true;

DmiMinus.Name = "DI-";
DmiMinus.DrawStyle = DRAWSTYLE_LINE;
    DmiMinus.PrimaryColor = RGB(255,0,255);
    DmiMinus.DrawZeros = true;

ADX.Name = "ADX";
ADX.DrawStyle = DRAWSTYLE_LINE;
    ADX.PrimaryColor = RGB(255,255,0);
    ADX.DrawZeros = true;

ADXR.Name = "ADXR";
ADXR.DrawStyle = DRAWSTYLE_LINE;
    ADXR.PrimaryColor = RGB(255,127,0);
    ADXR.DrawZeros = true;

LineVal1.Name = "Line 1 Value";
LineVal1.DrawStyle = DRAWSTYLE_LINE;
    LineVal1.PrimaryColor = RGB(255,127,0);
    LineVal1.DrawZeros = true;
    //LineVal1.Value = 1;

/* LineVal_2.Name = "Line 2 Value";
LineVal_2.DrawStyle = DRAWSTYLE_LINE;
    LineVal_2.PrimaryColor = RGB(255,127,0);
    LineVal_2.DrawZeros = true;

LineVal_3.Name = "Line 3 Value";
LineVal_3.DrawStyle = DRAWSTYLE_LINE;
    LineVal_3.PrimaryColor = RGB(255,127,0);
    LineVal_3.DrawZeros = true;

LineVal_4.Name = "Line 4 Value";
LineVal_4.DrawStyle = DRAWSTYLE_LINE;
    LineVal_4.PrimaryColor = RGB(255,127,0);
    LineVal_4.DrawZeros = true;

LineVal_5.Name = "DMI Dominance Line";
LineVal_5.DrawStyle = DRAWSTYLE_LINE;
    LineVal_5.PrimaryColor = RGB(255,127,0);
    LineVal_5.DrawZeros = true;

*/
Length.Name = "Length";
Length.SetInt(8);
Length.SetIntLimits(1, INT_MAX);

MALength.Name = "Mov Avg Length";
MALength.SetInt(13);
MALength.SetIntLimits(1, INT_MAX);

ADXRInterval.Name = "ADXR Interval";
ADXRInterval.SetInt(20);
ADXRInterval.SetIntLimits(1, INT_MAX);

    //During development set this flag to 1, so the DLL can be modified. When development is completed, set it to 0 to improve performance.
    sc.FreeDLL = 1;

return;
}

  
  //sc.LineVal1[sc.CurrentIndex]=0;
// Do data processing

sc.DataStartIndex = max(max(Length.GetInt(), Length.GetInt() + MALength.GetInt() + ADXRInterval.GetInt() - 2), Length.GetInt() + MALength.GetInt() - 1);

sc.DMI(sc.BaseData, DmiPlus, DmiMinus, sc.Index, Length.GetInt());

sc.ADX(sc.BaseData, ADX, sc.Index, Length.GetInt(), MALength.GetInt());

sc.ADXR(sc.BaseData, ADXR, sc.Index, Length.GetInt(), MALength.GetInt(), ADXRInterval.GetInt());

  sc.LineVal1[sc.Index]=15;
  //sc.LineVal_2[sc.Index]=11.0f;
  //sc.LineVal_3[sc.Index]=21.0f;
  //sc.LineVal_4[sc.Index]=35.0f;
  //sc.LineVal_5[sc.Index]=25.0f;  
  
  
  }


Any help would be appreciated. Thank you.
[2015-10-14 05:29:26]
crazybears - Posts: 314
Hi
sc.LineVal1[sc.Index]=15;

delete sc.

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

Login

Login Page - Create Account