Login Page - Create Account

Support Board


Date/Time: Fri, 10 May 2024 21:00:06 +0000



Post From: ASCIL Price Expansion Tool Issue

[2018-02-14 23:06:35]
Sierra Chart Engineering - Posts: 104368
Here is a code example for this:

/*==========================================================================*/
SCSFExport scsf_UseToolExampleDrawingPriceExpansion(SCStudyInterfaceRef sc)
{
  // Set configuration variables
  if (sc.SetDefaults)
  {
    sc.GraphName = "UseTool Example: Price Expansion";
    sc.GraphRegion = 0;
    sc.FreeDLL = 0;
    sc.AutoLoop = 0; //No automatic looping

    return;
  }

  int& r_LineNumber = sc.GetPersistentInt(1);

  if (sc.IsFullRecalculation)
  {
    s_UseTool Tool;
    //Tool.Clear();
    Tool.ChartNumber = sc.ChartNumber;
    Tool.DrawingType = DRAWING_PRICE_EXPANSION;
    Tool.ExtendLeft = 1;// Extend the horizontal lines to the left of the chart region.

    if (r_LineNumber != 0)
      Tool.LineNumber = r_LineNumber;

    // Update BarIndex to 40 bars from the end
    int BarIndex = sc.ArraySize - 100;// 100 bars back and from high to low
    BarIndex = max(BarIndex, 0);
    Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
    Tool.EndDateTime = sc.BaseDateTimeIn[BarIndex];//sc.ArraySize - 1
    Tool.BeginValue = sc.High[BarIndex];//sc.ArraySize - 1
    Tool.EndValue = sc.Low[BarIndex];
    Tool.Color = RGB(255, 0, 255); // Magenta
    Tool.AddMethod = UTAM_ADD_OR_ADJUST;

    for (int LevelIndex = 0; LevelIndex < min(8, ACSIL_DRAWING_MAX_LEVELS); LevelIndex++)
      Tool.RetracementLevels[LevelIndex] = LevelIndex * 10.0f;

    Tool.ShowPrice = 1;
    Tool.ShowPercent = 1;
    Tool.RoundToTickSize = 0;
    Tool.TextAlignment = DT_VCENTER; // label vertical alignment

    sc.UseTool(Tool);
    r_LineNumber = Tool.LineNumber;//Remember line number which has been automatically set

  }
}

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