Login Page - Create Account

Support Board


Date/Time: Fri, 29 Mar 2024 10:35:17 +0000



[User Discussion] - Double Stochastics source code

View Count: 1629

[2014-11-12 20:32:20]
Joopzor - Posts: 3
Hi,

Please may I request the original source for the double stochastics chart study. I use Sierra for charting but execute via the MT4 platform, would like to use Double Stochs on MT4 but require the source code to make the indicator.

I have extracted code from the .cpp studies file but haven't had success with it - I'm not sure if the source code is the same. Just in case, would you be able to provide me with the Double Stochastics math formula's used in the Sierra version.

Your assistance would be greatly appreciated - I saw a post from OLEB with the same request in 2008 and the source code was provided to him.

The screenshot can be viewed here http://prntscr.com/55qqf0

Thanks in advance,
JooP

Date Time Of Last Edit: 2014-11-12 20:41:35
imageStochs settings screenshot.png / V - Attached On 2014-11-12 20:31:58 UTC - Size: 25.53 KB - 371 views
[2014-11-13 00:16:17]
Sierra Chart Engineering - Posts: 104368
The source can code can be found in /ACS_Source/studies3.cpp in the folder that Sierra Chart is 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:
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
[2014-11-13 08:08:26]
Joopzor - Posts: 3
Thanks for the reply, I see the Double Stochastics entry therein but I do not see the formula or theory. Is the following code correct? I only see a call to a native function. I'm after the actual formula on how DS works the levels out. Please assist!

SCSFExport scsf_DoubleStochasticNew(SCStudyInterfaceRef sc)
{
  SCSubgraphRef DS = sc.Subgraph[0];
  SCSubgraphRef Line1 = sc.Subgraph[5];
  SCSubgraphRef Line2 = sc.Subgraph[6];
    
  SCInputRef Length = sc.Input[0];
  SCInputRef EMALength = sc.Input[2];
  SCInputRef MovAvgType = sc.Input[3];
  SCInputRef Line1Value = sc.Input[4];
  SCInputRef Line2Value = sc.Input[5];

  if(sc.SetDefaults)
  {
    sc.GraphName = "Double Stochastic";
    sc.GraphRegion = 1;
    sc.ValueFormat = 3;
    sc.AutoLoop = true;

    DS.Name = "DS";
    DS.DrawStyle = DRAWSTYLE_LINE;
    DS.PrimaryColor = RGB(0,255,0);
    DS.DrawZeros = false;
    
    Line1.Name = "Line 1";
    Line1.DrawStyle = DRAWSTYLE_LINE;
    Line1.PrimaryColor = RGB(0,255,0);
    Line1.DrawZeros = false;
    
    Line2.Name = "Line 2";
    Line2.DrawStyle = DRAWSTYLE_LINE;
    Line2.PrimaryColor = RGB(0,255,0);
    Line2.DrawZeros = false;

    Length.Name = "Length";
    Length.SetInt(10);
    Length.SetIntLimits(1,MAX_STUDY_LENGTH);
    
    EMALength.Name = "Moving Average Length";
    EMALength.SetInt(3);
    EMALength.SetIntLimits(1,MAX_STUDY_LENGTH);

    MovAvgType.Name = "Moving Average Type";
    MovAvgType.SetMovAvgType(MOVAVGTYPE_EXPONENTIAL);
    
    Line1Value.Name = "Line 1";
    Line1Value.SetInt(10);
    
    Line2Value.Name = "Line 2";
    Line2Value.SetInt(85);

    // 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 = 0;
    
    return;
  }

  sc.DoubleStochastic(sc.BaseDataIn, DS, Length.GetInt(), EMALength.GetInt(), MovAvgType.GetMovAvgType());

  Line1[sc.Index] = (float)Line1Value.GetInt();
  Line2[sc.Index] = (float)Line2Value.GetInt();
}

/

Date Time Of Last Edit: 2014-11-13 08:10:59
[2014-11-13 09:34:42]
Sierra Chart Engineering - Posts: 104368
What you need to do is look in the /ACS_Source/SCStudyFunctions.cpp file for the function DoubleStochastic_S.
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
[2014-11-13 10:27:51]
Joopzor - Posts: 3
Thank you, that is the original code I found in the first place. Our values are still not matching up. Would you be able to extract what formula is used. Our version returns similar results but the values are incorrect. The Sierra one seems smoother.

Apologies for the hassle and thank you again for your ongoing assistance.
[2014-11-14 03:13:30]
User83524 - Posts: 27
Not sure if this is worthwhile but forwarding
http://www.mql5.com/en/code/8310

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

Login

Login Page - Create Account