Login Page - Create Account

Support Board


Date/Time: Fri, 31 Jan 2025 15:02:23 +0000



Can you please add ACSIl two timeframe additive study

View Count: 768

[2019-05-05 19:48:41]
ertrader - Posts: 681
Hi support,
Can you please add the ACSIL in the User Contributed Advanced Custom Study System Source Code for the two timeframe trend additive study?

I've checked there and in both the UserContributedStudies2.cpp and UserContributedStudies.cpp files.

User Contributed Advanced Custom Study System Source Code
[2019-05-08 01:44:32]
ertrader - Posts: 681
Is this study ACSIL available?
[2019-05-08 19:03:52]
Sierra Chart Engineering - Posts: 104368
The code is old and poorly formatted. It was not developed by us:
SCSFExport scsf_2TrendAdd(SCStudyInterfaceRef sc)
{
  SCSubgraphRef   EnterNow = sc.Subgraph[0], LTF = sc.Subgraph[1], TF = sc.Subgraph[2], R1 = sc.Subgraph[3],
          se5 = sc.Subgraph[12], se12 = sc.Subgraph[13], sr = sc.Subgraph[14], xe5 = sc.Subgraph[15], xe12 = sc.Subgraph[16], xr = sc.Subgraph[17],
          lc = sc.Subgraph[20], le5 = sc.Subgraph[21], le12 = sc.Subgraph[22], lr = sc.Subgraph[23],  ple5 = sc.Subgraph[24], ple12 = sc.Subgraph[25], plr = sc.Subgraph[26];  

  if (sc.SetDefaults)
  {
    sc.GraphName="Two Timeframe Trend Additive";
    EnterNow.Name="EnterNow";  LTF.Name="LTF";    TF.Name="TF";  R1.Name="R1";
    se5.Name="se5";    se12.Name="se12";  sr.Name="sr";    xe5.Name="se5";    xe12.Name="se12";  xr.Name="sr";    
    lc.Name="lc";    le5.Name="le5";    le12.Name="le12";  lr.Name="lr";  ple5.Name="ple5";    ple12.Name="ple12";  plr.Name="plr";  
    sc.CalculationPrecedence = STD_PREC_LEVEL ;    sc.DrawZeros=0;    return;
  }
  /*
    This takes the trend from 5m and 30m using rsi>50 and ema1>ema2 for +ve
    When both trends are in the same direciton positive trend exists and price/value signals can be taken
    So it is the addition of 2 trends
  */
  int   i,p,p2,lp,hour,minute,second, minute2, as=sc.ArraySize-1, ST_Direction;
  int& li = sc.PersistVars->i1; int& offset = sc.PersistVars->i2;  int& lastshifted = sc.PersistVars->i3;
  int& lastdot = sc.PersistVars->i4; float& LT_Direction = sc.PersistVars->f1;
  
  if(sc.UpdateStartIndex==0) { li=0; offset=5; lastshifted=0; LT_Direction=0; ST_Direction=0; }
  
  for (i=sc.UpdateStartIndex; i < sc.ArraySize; i++)
  {
    p=i-1; lp=li-1; p2=i-2;
    sc.BaseDateTimeIn[i-1].GetTimeHMS(hour, minute, second); sc.BaseDateTimeIn[i].GetTimeHMS(hour, minute2, second);
    if( (minute2 % 30)==0 || (((minute+5) % 30)==0 && (minute2 % 30)!=0) ) { //|| (fmod(minute+5,30)==0 && fmod(minute2,30)!=0)
      lc[li]=sc.BaseDataIn[SC_LAST][p];
      sc.MovingAverage(lc, le5, MOVAVGTYPE_EXPONENTIAL, li, 5 );
      sc.MovingAverage(lc, le12, MOVAVGTYPE_EXPONENTIAL, li, 12);
      sc.RSI(lc, lr, li, MOVAVGTYPE_SIMPLE, 20);  
      if(lr[li]>50 && (le5[li]>le12[li] || (le5[li]==le12[li] && le5[lp]>le12[lp]))) LT_Direction=+1; else
      if(lr[li]<50 && (le5[li]<le12[li] || (le5[li]==le12[li] && le5[lp]<le12[lp]))) LT_Direction=-1; else
        LT_Direction=0;
      if(i<as) li++;
    }
    LTF[i]=LT_Direction/1.1;
    
  
    sc.MovingAverage(sc.BaseDataIn[SC_LAST], se5, MOVAVGTYPE_EXPONENTIAL, i, 5 );
    sc.MovingAverage(sc.BaseDataIn[SC_LAST], se12, MOVAVGTYPE_EXPONENTIAL, i, 12);
    sc.RSI(sc.BaseDataIn[SC_LAST], sr, i, MOVAVGTYPE_SIMPLE, 20);  
    if(sr[p]>50 && (se5[p]>se12[p] || (se5[p]==se12[p] && se5[p2]>se12[p2]))) TF[i]=+0.8; else
    if(sr[p]<50 && (se5[p]<se12[p] || (se5[p]==se12[p] && se5[p2]<se12[p2]))) TF[i]=-0.8; else
      TF[i]=0;
      
    EnterNow[i]=0;
  //  if( sc.BaseDateTimeIn[i].GetTimeInSeconds()>=HMS_TIME(10,00,00) && sc.BaseDateTimeIn[i].GetTimeInSeconds()<=HMS_TIME(12,00,00) ) {
      if(LTF[i]>0 && TF[i]>0) EnterNow[i]=.6; else
        if(LTF[i]<0 && TF[i]<0) EnterNow[i]=-.6;
  //  }    
  
  }
};

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

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

Login

Login Page - Create Account