Login Page - Create Account

Support Board


Date/Time: Thu, 29 Feb 2024 19:29:10 +0000



Post From: Time and Sales + draw to chart, Sierra Chart becomes unresponsive

[2022-11-06 17:27:16]
onnb - Posts: 660
hi - when using the time and sales with p_GDIFfunction Sierra Chart becomes unresponsive.
We get this on version 2448 (not sure on other versions, have not tested)

See script below that reproduces it.
Add to a chart and leave it running with a live feed. As time and sales records come in the chart/SC will freeze at some point.



#include "sierrachart.h"


SCDLLName("Study Becomes Unresponsive")

static void DrawToChart(HWND hWnd, HDC hdc, SCStudyInterfaceRef sc)
{
  int& justavariable = sc.GetPersistentInt(1);
  c_SCTimeAndSalesArray TimeSales;
  sc.GetTimeAndSales(TimeSales);
  int TimeSalesSize = TimeSales.Size();
  if (TimeSales.Size() > 0)
  {
    int type = 0;
    int vol = 0;
    float price = 0;

    for (int i = TimeSales.Size() - 1; i >= 0; i--)
    {
      if (TimeSales[i].Type == SC_TS_BID)
        justavariable += TimeSales[i].Volume;
      if (TimeSales[i].Type == SC_TS_ASK)
        justavariable += TimeSales[i].Volume;
    }
  }
}

SCSFExport scsf_StudyBecomesUnresponsive(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "Study Becomes Unresponsive";
    sc.StudyDescription = "";
    sc.AutoLoop = 0;
    sc.GraphRegion = 0;
    sc.p_GDIFunction = DrawToChart;
    return;
  }
}