Login Page - Create Account

Support Board


Date/Time: Sat, 11 Jan 2025 04:46:28 +0000



Post From: Retracement Levels.

[2016-10-22 04:06:27]
User429169 - Posts: 14
Thank you for replay,

I tried with 2 Retracement levels code. but displaying only One.

SCSFExport scsf_CustomRetracement(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "Retracement";
    sc.StudyDescription = "";
    sc.FreeDLL = 1;
    sc.GraphRegion = 0;
    sc.FreeDLL = 0;
    sc.AutoLoop = 0;
    return;
    }

    int &TextDrawingLineNumber = sc.GetPersistentInt(1);

    if (TextDrawingLineNumber != 0 && sc.LastCallToFunction)
    {
      // Be sure to remove the Text drawing added as a user drawn drawing
      sc.DeleteUserDrawnACSDrawing(sc.ChartNumber, TextDrawingLineNumber);
      return;//No further processing needed in this case.
    }

    int BarIndex;
    s_UseTool Tool;
////// First Retracement

    Tool.Clear(); // reset tool structure for our next use
    Tool.ChartNumber = sc.ChartNumber;
    Tool.DrawingType = DRAWING_RETRACEMENT;
    Tool.ExtendLeft = 0; // .ExtendLeft = 1;// Extend the horizontal retracement lines to the left of the chart region.
    int &LineNumber4 = sc.GetPersistentInt(4);
    if (LineNumber4 != 0)
      Tool.LineNumber = LineNumber4;
    // Update BarIndex to 40 bars from the end
    BarIndex = sc.ArraySize - 40;
    BarIndex = max(BarIndex, 0);
    Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
    Tool.EndDateTime = sc.BaseDateTimeIn[sc.ArraySize - 1];
    Tool.BeginValue = sc.High[sc.ArraySize - 1];
    Tool.EndValue = sc.Low[BarIndex];
    Tool.Color = RGB(255, 0, 255); // Magenta
    Tool.AddMethod = UTAM_ADD_OR_ADJUST;
    for (int i = 0; i < 16; i++)
    Tool.RetracementLevels = i * 10.0f;
    Tool.ShowPrice = 1;
    Tool.ShowPercent = 1;
    Tool.RoundToTickSize = 0;
    Tool.TextAlignment = DT_LEFT; // label vertical alignment

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


////// Second Retracement

    
    Tool.Clear(); // reset tool structure for our next use
    Tool.ChartNumber = sc.ChartNumber;
    Tool.DrawingType = DRAWING_RETRACEMENT;
    Tool.ExtendRight = 0;
    int &LineNumber25 = sc.GetPersistentInt(4);
    if (LineNumber25 != 0)
      Tool.LineNumber = LineNumber25;
    // Update BarIndex to 40 bars from the end
    BarIndex = sc.ArraySize - 40;
    BarIndex = max(BarIndex, 0);
    Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
    Tool.EndDateTime = sc.BaseDateTimeIn[sc.ArraySize - 1];
    Tool.BeginValue = sc.High[sc.ArraySize - 1];
    Tool.EndValue = sc.Low[BarIndex];
    Tool.Color = RGB(255, 0, 255); // Magenta
    Tool.AddMethod = UTAM_ADD_OR_ADJUST;
    for (int i = 0; i < 8; i++)
    Tool.RetracementLevels = i * 10.0f;
    Tool.ShowPrice = 1;
    Tool.ShowPercent = 1;
    Tool.RoundToTickSize = 0;
    Tool.TextAlignment = DT_RIGHT; // label vertical alignment

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

}

Any thing missing from the code.

Thank You

Date Time Of Last Edit: 2016-10-22 04:08:54