Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 00:37:07 +0000



Post From: sierra chart visible chart price

[2018-03-22 18:20:44]
JoseyWales - Posts: 67
Not sure if you wanted it as a Dll or as an ACSIL example, but this is something I came up with. Dll attached below.


#include "sierrachart.h"

SCDLLName("High/Low Values For Visible Bars")

SCSFExport scsf_HighLowValuesForVisibleBars(SCStudyInterfaceRef sc)
{
  SCSubgraphRef High = sc.Subgraph[0];
  SCSubgraphRef Low = sc.Subgraph[1];

  if (sc.SetDefaults)
  {
    sc.AutoLoop = 0;
    sc.GraphName = "High/Low Values For Visible Bars";
    sc.GraphRegion = 0;
    sc.UpdateAlways = 1;

    // Graphs

    High.DrawStyle = DRAWSTYLE_VALUE_ON_HIGH;
    High.Name = "High";
    High.PrimaryColor = COLOR_GREEN;

    Low.DrawStyle = DRAWSTYLE_VALUE_ON_LOW;
    Low.Name = "Low";
    Low.PrimaryColor = COLOR_RED;

    return;
  }

  const int numberOfVisibleBars = sc.IndexOfLastVisibleBar - sc.IndexOfFirstVisibleBar + 1;

  int& indexOfPreviousHighestValue = sc.GetPersistentInt(0);
  const int indexOfHighestValue = sc.GetIndexOfHighestValue(sc.High, sc.IndexOfLastVisibleBar, numberOfVisibleBars);

  if (indexOfPreviousHighestValue != indexOfHighestValue)
  {
    High[indexOfPreviousHighestValue] = 0;
    indexOfPreviousHighestValue = indexOfHighestValue;
  }

  int& indexOfPreviousLowestValue = sc.GetPersistentInt(1);
  const int indexOfLowestValue = sc.GetIndexOfLowestValue(sc.Low, sc.IndexOfLastVisibleBar, numberOfVisibleBars);

  if (indexOfPreviousLowestValue != indexOfLowestValue)
  {
    Low[indexOfPreviousLowestValue] = 0;
    indexOfPreviousLowestValue = indexOfLowestValue;
  }

  High[indexOfHighestValue] = sc.High[indexOfHighestValue];
  Low[indexOfLowestValue] = sc.Low[indexOfLowestValue];
}

Date Time Of Last Edit: 2018-03-22 18:21:20
attachmentHighLowValuesForVisibleBars_64.dll - Attached On 2018-03-22 18:19:27 UTC - Size: 84.5 KB - 340 views