Login Page - Create Account

Support Board


Date/Time: Thu, 29 Feb 2024 17:25:22 +0000



[Programming Help] - sc.GetBarHasClosedStatus from another chart different time frame ACSIL

View Count: 304

[2023-03-18 18:56:32]
User725043 - Posts: 27
Hi,

Have ChartOne set to a time interval and have ChartTwo set to a different time interval.

What is the function, ACSIL Interface Members - Functions, or how do I get the bar has closed status pulled from ChartTwo into an ACSIL study on ChartOne?

Have looked at the information for sc.GetBarHasClosedStatus at links below and in the code example in Studies.cpp but haven't been able to find the nomenclature to reference it from another time frame chart.

sc.GetBarHasClosedStatus()

Referencing Other Time Frames and Symbols When Using the ACSIL: Referencing Data from Other Time Frames By Direct Referencing of the Other Timeframe
[2023-03-25 12:28:17]
User725043 - Posts: 27
1) Per:

Referencing Other Time Frames and Symbols When Using the ACSIL: Referencing Data from Other Time Frames By Direct Referencing of the Other Timeframe

loaded the reference chart base graph data by:

// Define a graph data object to get all of the base graph data
SCGraphData BaseGraphData;

// Get the base graph data from the specified chart
sc.GetChartBaseData(ChartNumber.GetInt(), BaseGraphData);

2) In trying to set a call to sc.GetChartBaseData using sc.GetBarHasClosedStatus get error in Visual Studio saying not a member.

3) Looking at sierrachart.h it appears that sc.GetBarHasClosedStatus is set to an integer:

/*========================================================================

  BHCS_BAR_HAS_CLOSED: Element at BarIndex has closed.

  BHCS_BAR_HAS_NOT_CLOSED: Element at BarIndex has not closed.

  BHCS_SET_DEFAULTS: Configuration and defaults are being set. Allow your SetDefaults code block to run.
  ------------------------------------------------------------------------*/

  int GetBarHasClosedStatus()
  {
    return GetBarHasClosedStatus(Index);
  }

  int GetBarHasClosedStatus(int BarIndex)
  {
    if (SetDefaults)
      return BHCS_SET_DEFAULTS;

    if (BarIndex != ArraySize - 1)
      return BHCS_BAR_HAS_CLOSED;
    else
      return BHCS_BAR_HAS_NOT_CLOSED;
  }


4) set up an int variable in the reference chart and realized this that sc.GetBarHasClosedStatus is setting to 2 or 3 in the reference chart. tried to pass that as a subgraph to the main chart where the automated trading study via ACSIL is, using both Study Overlay/Price and sc.GetStudyArraysFromChartUsingID, but was unsuccessful backtesting in Replay -> All Charts In Chartbook, getting that to work.

5) Can you please provide where the data for sc.GetBarHasClosedStatus is being stored in Sierra Chart and what is the way to use ACSIL to access it?

6) Alternatively can you please create a sc.GetBarHasClosedStatusForChart function similar to the sc.GetBarPeriodParametersForChart discussed here? :

Chart Bar Period Parameters for a Referenced Chart
[2023-03-25 12:45:19]
User431178 - Posts: 395
Here is a clue from what you posted above


if (BarIndex != ArraySize - 1)
return BHCS_BAR_HAS_CLOSED;

sc.GetBarHasClosedStatus()

From the information linked above

The very last bar in the chart is never considered a closed bar until there is a new bar added to the chart. It is not possible to know otherwise because of the following reasons: The chart bars are based upon a variable timeframe like Number of Trades or Volume and the ending can never be known until there is a new bar, or because there is not a trade at the very final second of a fixed time bar.

BHCS_BAR_HAS_CLOSED: Element at BarIndex has closed. This will always be returned for any bar in the chart other than the last bar in the chart.

Get the arraysize from the reference chart, if the bar you are checking is less than arraysize-1 the bar is closed.

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

Login

Login Page - Create Account