Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 05:26:36 +0000



Post From: sc.IndexOfFirstVisibleBar not updating with sc.UpdateAlways = 1;

[2019-04-06 13:16:40]
binaryduke - Posts: 360
As per title, sc.IndexOfFirstVisibleBar and sc.IndexofLastVisibleBar are not updating on chart scrolling even with sc.UpdateAlways = 1.

Example test program that demonstrates this:



#include "sierrachart.h"

SCDLLName("VisibleBarTest")


/*==========================================================================*/
SCSFExport scsf_VisibleBarTest(SCStudyInterfaceRef sc)
{

  SCSubgraphRef Subgraph_FirstBarNumber = sc.Subgraph[0];
  SCSubgraphRef Subgraph_LastBarNumber = sc.Subgraph[1];
  
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.GraphName = "Visible Bar Test";
    sc.ValueFormat = 1;

    sc.AutoLoop = true;

    Subgraph_FirstBarNumber.Name = "First Bar";
    Subgraph_FirstBarNumber.DrawStyle = DRAWSTYLE_SUBGRAPH_NAME_AND_VALUE_LABELS_ONLY;
    Subgraph_FirstBarNumber.PrimaryColor = COLOR_GREEN;

    Subgraph_LastBarNumber.Name = "First Bar";
    Subgraph_LastBarNumber.DrawStyle = DRAWSTYLE_SUBGRAPH_NAME_AND_VALUE_LABELS_ONLY;
    Subgraph_LastBarNumber.PrimaryColor = COLOR_GREEN;

    sc.UpdateAlways = 1;  //for visible bars

    return;
  }

  Subgraph_FirstBarNumber[sc.Index] = sc.IndexOfFirstVisibleBar;
  Subgraph_LastBarNumber[sc.Index] = sc.IndexOfLastVisibleBar;
}
/*==========================================================================*/