Login Page - Create Account

Support Board


Date/Time: Mon, 23 Dec 2024 20:14:50 +0000



Post From: Compiling study gives error

[2015-10-09 23:42:46]
KhaosTrader - Posts: 128
I copied the "SCSFExport scsf_BollingerSqueeze(SCStudyInterfaceRef sc)" code into my own custom study file.

When I try to compile it (unmodified) I get the following error:

"None of the selected source files contains the SCDLLName line at the top of the file. Refer to ACSIL documentation.
-- End of Build -- 19:38:39"

I have the following include:
#include "sierrachart.h"
#include <math.h>
#include "scstudyfunctions.h"


What must I do to make it compile?


By the way , here is the code:


/*==========================================================================*/
/*
Bollinger bands squeeze.

Proportion = (kUpper - kLower) / (bbUpper - bbLower);

*/
SCSFExport scsf_BollingerSqueeze(SCStudyInterfaceRef sc)
{
  SCSubgraphRef BandsRatio = sc.Subgraph[0];
  SCSubgraphRef SqueezeIndicator = sc.Subgraph[1];
  SCSubgraphRef Keltner = sc.Subgraph[2];
  SCSubgraphRef BollingerBands = sc.Subgraph[3];

  SCInputRef InputData = sc.Input[0];
  SCInputRef InternalMovAvgType = sc.Input[1];
  SCInputRef KeltnerBandsLength = sc.Input[2];
  SCInputRef KeltnerTrueRangeMALength = sc.Input[3];
  SCInputRef KeltnerBandsMultiplier = sc.Input[4];
  SCInputRef BollingerBandsLength = sc.Input[5];
  SCInputRef BollingerBandsMultiplier = sc.Input[6];

  if (sc.SetDefaults)
  {
    sc.GraphName="Bollinger Squeeze";
    sc.StudyDescription="Bollinger Squeeze";

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


    BandsRatio.Name = "Bands Ratio";
    BandsRatio.DrawStyle = DRAWSTYLE_BAR;
    BandsRatio.PrimaryColor = RGB(0,255,0);
    BandsRatio.SecondaryColor = RGB(255,0,0);
    BandsRatio.SecondaryColorUsed = true;
    BandsRatio.DrawZeros = true;

    SqueezeIndicator.Name = "Squeeze Indicator";
    SqueezeIndicator.DrawStyle = DRAWSTYLE_POINT;
    SqueezeIndicator.LineWidth = 3;
    SqueezeIndicator.PrimaryColor = RGB(0,255,0);
    SqueezeIndicator.SecondaryColor = RGB(255,0,0);
    SqueezeIndicator.SecondaryColorUsed = true;
    SqueezeIndicator.DrawZeros = true;

    InputData.Name = "Input Data";
    InputData.SetInputDataIndex(SC_LAST);

    InternalMovAvgType.Name="Moving Average Type for Internal Calculations";
    InternalMovAvgType.SetMovAvgType(MOVAVGTYPE_SIMPLE);

    KeltnerBandsLength.Name="Keltner Bands Length";
    KeltnerBandsLength.SetInt(20);
    KeltnerBandsLength.SetIntLimits(1,MAX_STUDY_LENGTH);

    KeltnerTrueRangeMALength.Name = "Keltner True Range MovAvg Length";
    KeltnerTrueRangeMALength.SetInt(20);
    KeltnerTrueRangeMALength.SetIntLimits(1,MAX_STUDY_LENGTH);

    KeltnerBandsMultiplier.Name="Keltner Bands Multiplier";
    KeltnerBandsMultiplier.SetFloat(2.0f);

    BollingerBandsLength.Name="Bollinger Bands Length";
    BollingerBandsLength.SetInt(20);
    BollingerBandsLength.SetIntLimits(1,MAX_STUDY_LENGTH);

    BollingerBandsMultiplier.Name="Bollinger Bands Multiplier";
    BollingerBandsMultiplier.SetFloat(2.0f);

    return;
  }

  if ((sc.CurrentIndex < KeltnerBandsLength.GetInt()) || (sc.CurrentIndex < BollingerBandsLength.GetInt()))
    return;

  // calculate Bollinger Bands
  sc.BollingerBands(sc.BaseData[InputData.GetInputDataIndex()],BollingerBands,BollingerBandsLength.GetInt(),BollingerBandsMultiplier.GetFloat(),InternalMovAvgType.GetMovAvgType());

  // calculate Keltner
  sc.Keltner( sc.BaseData,sc.BaseData[InputData.GetInputDataIndex()],Keltner,KeltnerBandsLength.GetInt(), InternalMovAvgType.GetMovAvgType(),BollingerBandsLength.GetInt(),InternalMovAvgType.GetMovAvgType(), KeltnerBandsMultiplier.GetFloat(),KeltnerBandsMultiplier.GetFloat());


  float KUp = Keltner.Arrays[0][sc.CurrentIndex];
  float KDown = Keltner.Arrays[1][sc.CurrentIndex];

  float UBB = BollingerBands.Arrays[0][sc.CurrentIndex];
  float LBB = BollingerBands.Arrays[1][sc.CurrentIndex];

  if ((UBB > KUp) && (LBB < KDown))
    SqueezeIndicator.DataColor[sc.CurrentIndex] = SqueezeIndicator.PrimaryColor;
  else
    SqueezeIndicator.DataColor[sc.CurrentIndex] = SqueezeIndicator.SecondaryColor;

  BandsRatio[sc.CurrentIndex] = (KUp-KDown)/(UBB - LBB) - 1.0f;

  if (BandsRatio[sc.CurrentIndex] >= 0)
    BandsRatio.DataColor[sc.CurrentIndex] = BandsRatio.PrimaryColor;
  else
    BandsRatio.DataColor[sc.CurrentIndex] = BandsRatio.SecondaryColor;
}

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








//***************
Thanks