Login Page - Create Account

Support Board


Date/Time: Tue, 04 Mar 2025 09:09:28 +0000



[Programming Help] - Custom Chart and Historical Market Depth Historical Graph

View Count: 2174

[2017-02-14 13:46:11]
User64410 - Posts: 14
Hi,
I have developed custom chart based on -BID_ASK_TRADE_SYNC data. Chart works quite fine and do exactly what I need. But I have discovered:
I actualize Last but there is no "white box" showing actual Last price on Y axis.

I'm not able to attach Market Depth Historical Graph to this chart. What do I need to change to solve this? If I try to attach Market Depth Historical Graph Message Log shows:
"Custom DLL Study DateTime: Out of bounds array error at Index 7866 (it looks like last Index).

How can I solve this?

Thank you.

SCSFExport scsf_MyCustom(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Open = sc.Subgraph[0];
  SCSubgraphRef High = sc.Subgraph[1];
  SCSubgraphRef Low = sc.Subgraph[2];
  SCSubgraphRef Last = sc.Subgraph[3];
  .
  .
  .

  if (sc.SetDefaults) {
    // Set the defaults
    sc.GraphName = "My Graph";
    sc.AutoLoop = 1;
    sc.IsCustomChart = 1; // true
    sc.GraphRegion = 0; // First region
    sc.DrawZeros = 0; // false
    sc.StandardChartHeader = 1; // true
    sc.DrawZeros = 0;
    sc.FreeDLL = 1;

    // HIGH/LOW subgraf:
    High.Name = "High";
    High.DrawStyle = DRAWSTYLE_STAIR;
    High.PrimaryColor = RGB(70, 70, 70);

    Low.Name = "Low";
    Low.DrawStyle = DRAWSTYLE_STAIR;
    Low.PrimaryColor = RGB(70, 70, 70);

    Last.Name = "Last";
    Last.DrawStyle = DRAWSTYLE_STAIR;

    Open.Name = "Open";
    Open.DrawStyle = DRAWSTYLE_IGNORE;
    Open.PrimaryColor = RGB(70, 70, 70);
    .
    .
    .
  
    // inputs:
    sc.Input[0].Name = "pouze vetsi nez";
    sc.Input[0].SetInt(0);
    .
    .
    .

    return;
  }


  if (sc.UpdateStartIndex == 0){
    sc.ResizeArrays(1);
  }
  
  // persist vars:
  int& k = sc.GetPersistentInt(0);
  int& idx = sc.GetPersistentInt(1);
  .
  .
  .

  // first values:
  if (sc.Index == 0){
    sc.DateTimeOut[0] = sc.BaseDateTimeIn[sc.Index];
    Open[0] = sc.BaseDataIn[0][sc.Index];
    Low[0] = sc.BaseDataIn[2][sc.Index];
    High[0] = sc.BaseDataIn[1][sc.Index];
    Last[0] = sc.BaseDataIn[3][sc.Index];
    idx = 0;
  }

  // actualization:
  if (sc.Index > 0) {
    sc.DateTimeOut[idx] = sc.BaseDateTimeIn[sc.Index];
    Open[idx] = sc.BaseDataIn[0][sc.Index];
    Low[idx] = sc.BaseDataIn[2][sc.Index];
    High[idx] = sc.BaseDataIn[1][sc.Index];
    Last[idx] = sc.BaseDataIn[3][sc.Index];
    Last.DataColor[idx] = sc.Input[10].GetColor();
  }
  
  // new bar condition:
  if () {
    
    // add bar:
    sc.AddElements(1);
    
    // ++ custom index for next use:  
    idx++;
    
    // reset other persist vars:
    k = 0;
    .
    .
    .
  }

}


Date Time Of Last Edit: 2017-02-14 13:54:17
attachmentcustom.cpp - Attached On 2017-02-14 13:52:15 UTC - Size: 1.85 KB - 395 views
[2017-02-14 18:00:03]
Sierra Chart Engineering - Posts: 104368
You cannot use the Market Depth Historical Graph study on a custom ACSIL chart.
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
[2017-02-15 09:58:01]
User64410 - Posts: 14
Are you sure? I tried to apply Market Depth Historical Graph to your example of custom chart called Copy of Base Graph and it works fine.

In my custom chart i got in to situation, when Market Depth Graph is not fixed to price (screen attached). There is no error in message log after sc.GraphDrawType = GDT_OHLCBAR. You have no advice what should be missing to fix that Market depth Graph to actual price?
imageSnímek obrazovky 2017-02-15 v 10.57.13.png / V - Attached On 2017-02-15 09:57:32 UTC - Size: 235.52 KB - 387 views
[2017-02-15 18:03:42]
Sierra Chart Engineering - Posts: 104368
Make sure the Scale Range for all of the studies in Chart Region 1 are set to Automatic:
http://www.sierrachart.com/index.php?page=doc/Scaling.html#ScaleWindowStudy
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
[2021-12-07 21:08:50]
rread - Posts: 10
Is it still the case that one cannot use the Market Depth study on a custom chart or is there a method to do this? The suggestion to use the Automatic scale range seems to imply it may be possible?

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

Login

Login Page - Create Account