Login Page - Create Account

Support Board


Date/Time: Tue, 04 Mar 2025 11:54:11 +0000



Post From: Custom Chart and Historical Market Depth Historical Graph

[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