Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 05:11:08 +0000



sc.IndexOfFirstVisibleBar not updating with sc.UpdateAlways = 1;

View Count: 861

[2019-04-06 13:16:40]
binaryduke - Posts: 353
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;
}
/*==========================================================================*/



[2019-04-07 08:04:17]
Sierra Chart Engineering - Posts: 104368
They do update but the study function is not going to reveal that. We made the necessary changes:

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 = "Last 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.IndexOfLastVisibleBar] = sc.IndexOfFirstVisibleBar;
  Subgraph_LastBarNumber[sc.IndexOfLastVisibleBar] = sc.IndexOfLastVisibleBar;

}

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

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account