Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 08:00:21 +0000



Post From: KD Slow custom study source?

[2014-01-19 05:09:00]
slipperfoot - Posts: 11
I was abble to open the studies6.cpp file and find kdslow. But was unable to achieve my goal :( I am real newb but hey, at least i gave it a shot. This is the portion i edited to see if it will work
SCSFExport scsf_KDSlowStochastic(SCStudyInterfaceRef sc)
{
  SCSubgraphRef SlowK = sc.Subgraph[0];
  SCSubgraphRef SlowD = sc.Subgraph[1];
  SCSubgraphRef Line1 = sc.Subgraph[2];
  SCSubgraphRef Line2 = sc.Subgraph[3];
  SCSubgraphRef Temp4 = sc.Subgraph[4];

  SCInputRef FastKLength = sc.Input[2];
  SCInputRef FastDLength = sc.Input[3];
  SCInputRef SlowDLength = sc.Input[4];
  SCInputRef Line1Value = sc.Input[5];
  SCInputRef Line2Value = sc.Input[6];
  SCInputRef MovAvgType = sc.Input[7];
  SCInputRef InputDataHigh = sc.Input[8];
  SCInputRef InputDataLow = sc.Input[9];
  SCInputRef InputDataLast = sc.Input[10];

  if ( sc.SetDefaults )
  {
    sc.GraphName = "KD - Slow";

    sc.ValueFormat = 2;

    SlowK.Name = "Slow %K";
    SlowK.DrawStyle = DRAWSTYLE_LINE;
    SlowK.PrimaryColor = RGB(0,255,0);
    SlowK.DrawZeros = true;

    SlowD.Name = "Slow %D";
    SlowD.DrawStyle = DRAWSTYLE_LINE;
    SlowD.PrimaryColor = RGB(255,0,255);
    SlowD.DrawZeros = true;
    
    SlowJ.Name = "Slow %J";
    SlowJ.Drawstyle = DRAWSTYLE_LINE;
    SlowJ.PrimaryColor = RGB(255,165,0);
    SlowJ.DrawZeros = true;

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

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

    Line3.Name = "Line3";
    Line3.DrawStyle = DRAWSTYLE_LINE;
    Line3.PrimaryColor = RGB(255,165,0);
    Line3.DrawZeros = true;
    
    FastKLength.Name = "Fast %K Length";
    FastKLength.SetInt(20);
    FastKLength.SetIntLimits(1,MAX_STUDY_LENGTH);

    FastDLength.Name = "Fast %D Length (Slow %K)";
    FastDLength.SetInt(3);
    FastDLength.SetIntLimits(1,MAX_STUDY_LENGTH);
    
    FastJLength.Name = "Fast %J Length (Slow %J)";
    FastJLength.SetInt(13);
    FastDLength.SetIntLimits(1,MAX_STUDY_LENGTH);

    SlowDLength.Name = "Slow %D Length";
    SlowDLength.SetInt(3);
    SlowDLength.SetIntLimits(1,MAX_STUDY_LENGTH);

    Line1Value.Name = "Line1 Value";
    Line1Value.SetFloat(70);

    Line2Value.Name = "Line2 Value";
    Line2Value.SetFloat(30);

    MovAvgType.Name = "Moving Average Type";
    MovAvgType.SetMovAvgType(MOVAVGTYPE_SIMPLE);

    InputDataHigh.Name = "Input Data for High";
    InputDataHigh.SetInputDataIndex(SC_HIGH);

    InputDataLow.Name = "Input Data for Low";
    InputDataLow.SetInputDataIndex(SC_LOW);

    InputDataLast.Name = "Input Data for Last";
    InputDataLast.SetInputDataIndex(SC_LAST);


    sc.AutoLoop = true;
    return;
  }
but i only got these errors:
"C:\SierraChart\CPPCompiler\bin\g++.exe" "C:\SierraChart\ACS_Source\Studies6(1).cpp" -march=i686 -mtune=i686 -O2 -shared -static -static-libgcc -static-libstdc++ -s -fno-rtti -fno-exceptions -o "C:\SierraChart\Data\Studies6(1).dll"

C:\SierraChart\ACS_Source\Studies6(1).cpp: In function 'void scsf_KDSlowStochastic(SCStudyInterfaceRef)':
C:\SierraChart\ACS_Source\Studies6(1).cpp:1073:3: error: 'SlowJ' was not declared in this scope
SlowJ.Name = "Slow %J";
^
C:\SierraChart\ACS_Source\Studies6(1).cpp:1088:3: error: 'Line3' was not declared in this scope
Line3.Name = "Line3";
^
C:\SierraChart\ACS_Source\Studies6(1).cpp:1101:3: error: 'FastJLength' was not declared in this scope
FastJLength.Name = "Fast %J Length (Slow %J)";
^
C:\SierraChart\ACS_Source\Studies6(1).cpp:1148:2: error: 'SlowJ' was not declared in this scope
SlowJ[sc.Index] = Temp4.Arrays[2][sc.Index];
^
C:\SierraChart\ACS_Source\Studies6(1).cpp: In function 'void scsf_WriteBarDataToFile(SCStudyInterfaceRef)':
C:\SierraChart\ACS_Source\Studies6(1).cpp:2907:48: error: 'sprintf_s' was not declared in this scope
sprintf_s(MillisecondsText,".%d",millisecond);
^
C:\SierraChart\ACS_Source\Studies6(1).cpp:2913:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
formatString = "%s %.2d:%.2d:%.2d%s %s %s %s %s %.0f %.0f %.0f %.0f\r\n";
^
C:\SierraChart\ACS_Source\Studies6(1).cpp:2916:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
formatString = "%s, %.2d:%.2d:%.2d%s, %s, %s, %s, %s, %.0f, %.0f, %.0f, %.0f\r\n";
^
C:\SierraChart\ACS_Source\Studies6(1).cpp:2921:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
formatString = "%s\t%.2d:%.2d:%.2d%s\t%s\t%s\t%s\t%s\t%.0f\t%.0f\t%.0f\t%.0f\r\n";

If anyone feels up to helping a newb out that would be awesome! I think it would be a great opportunity to learn something.
Thanks again SC!
Date Time Of Last Edit: 2014-01-19 06:24:51