Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 14:58:32 +0000



Post From: Double Stochastics source code

[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