Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 05:28:44 +0000



Post From: ACSIL programming assistance request

[2024-01-04 05:18:30]
User183724 - Posts: 183
ACSIL programming assistance request

I'm attempting to use the sc.ZigZag function

sc.ZigZag()

option 2

SCFloatArrayRef ZigZag (SCFloatArrayRef InputDataHigh, SCFloatArrayRef InputDataLow, SCSubgraphRef Out, float ReversalPercent, int StartIndex); Auto-looping only.

I've attached my code below. Ive attempted to use sc.BaseData and sc.BaseDataIn (with inputs) but neither are producing results in the subgraph.

any assistance appreciated

Tim


code follows.

/*==========================================================================*/

// The top of every source code file must include this line
#include "sierrachart.h"

// Name of the custom study.
SCDLLName("ZigZag111")

/*==========================================================================*/
SCSFExport scsf_ZigZag111(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_ZigZag1 = sc.Subgraph[0];



  // SCInputRef Input_InputData1 = sc.Input[1]; // un comment these to use with inputs below if used
  // SCInputRef Input_InputData2 = sc.Input[2];

  if(sc.SetDefaults)
  {
    sc.GraphName="ZigZag11";

    sc.AutoLoop = 1;
    sc.GraphRegion = 0;

    Subgraph_ZigZag1.Name="ZigZag1";
    Subgraph_ZigZag1.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_ZigZag1.PrimaryColor = RGB(0,255,0);
    Subgraph_ZigZag1.DrawZeros = false;

/*
    
    // un comment these to use with inputs below if used
    
    Input_InputData1.Name = "Input Data1";
    Input_InputData1.SetInputDataIndex(SC_HIGH);
    
    Input_InputData2.Name = "Input Data2";
    Input_InputData2.SetInputDataIndex(SC_LOW);
    
*/
    
    return;
  }

float ReversalPercent = 0.17; // change here for now as req
  
// un comment this to use with inputs above if used  
  // sc.ZigZag(sc.BaseDataIn[Input_InputData1.GetInputDataIndex()], sc.BaseDataIn[Input_InputData2.GetInputDataIndex()], Subgraph_ZigZag1, ReversalPercent, sc.Index);

  

sc.ZigZag(sc.BaseData[SC_HIGH], sc.BaseData[SC_LOW], Subgraph_ZigZag1, ReversalPercent, sc.Index);  

  
// /*
SCString MessageString;
MessageString.Format("Subgraph_ZigZag1 %f sc_Index %d" , Subgraph_ZigZag1[sc.Index], sc.Index);
   sc.AddMessageToLog(MessageString, 0);
// */
  
  
  
}
/*==========================================================================*/

nothing follows