Login Page - Create Account

Support Board

Date/Time: Mon, 27 Jun 2022 03:29:06 +0000

[User Discussion] - KD Slow custom study source?

View Count: 1071

[2014-01-19 00:07:49]
slipperfoot - Posts: 11
I wanted to check out building a advanced custom study based on the KD Slow. I wanted to add a J line. Where the J line represents the divergence of the %D value from the %K. The value of J can go beyond [0, 100] for %K and %D lines on the chart.
I was wondering if the KD slow custom studies source code is available? Thanks SC!
[2014-01-19 03:26:50]
Sierra Chart Engineering - Posts: 103470
Yes. This is the same as the Stochastic studies. You can find the source code in the /ACS_Source folder in the folder where Sierra Chart installed to.
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:

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: 2014-01-19 03:27:01
[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";

    FastDLength.Name = "Fast %D Length (Slow %K)";
    FastJLength.Name = "Fast %J Length (Slow %J)";

    SlowDLength.Name = "Slow %D Length";

    Line1Value.Name = "Line1 Value";

    Line2Value.Name = "Line2 Value";

    MovAvgType.Name = "Moving Average Type";

    InputDataHigh.Name = "Input Data for High";

    InputDataLow.Name = "Input Data for Low";

    InputDataLast.Name = "Input Data for Last";

    sc.AutoLoop = true;
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
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
[2014-01-19 15:59:43]
jackw - Posts: 56
Don't see a need for a custom study. Use can use the "Study Subgraphs Difference" study to plot the difference between %K and %D. On the attached chart, I have placed the study in its own pane, but you could also overlay it on the same pane as the KD slow.
imageChart1.jpg / V - Attached On 2014-01-19 15:59:03 UTC - Size: 47.48 KB - 367 views
[2014-01-19 17:42:18]
slipperfoot - Posts: 11
Yes i been dying to figure out how to overlay in same pane! I didn't think it was possible
[2014-01-19 18:28:40]
jackw - Posts: 56
Just set the Chart Region on the "Study Subgraphs Difference" study to the same number as the KD Slow study. Optionally, you can change the scaling on the "Study Subgraphs Difference" study to "Independent" to make it scale better.

[2014-01-19 18:40:15]
slipperfoot - Posts: 11
thanks jackw!

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


Login Page - Create Account