Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 20:08:33 +0000



Post From: Add additional symbol for ASCIL

[2024-08-07 19:32:37]
ForgivingComputers.com - Posts: 960

#include "sierrachart.h"

SCDLLName("Custom Study DLL")

SCSFExport scsf_TickSPAccess(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Study configuration
    sc.GraphName = "TICK-SP Data Access";
    sc.StudyDescription = "Access TICK-SP data and display it.";

    // Configure the subgraph
    sc.Subgraph[0].Name = "TICK-SP Value";
    sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE;
    sc.Subgraph[0].PrimaryColor = RGB(0, 255, 0);
    sc.Subgraph[0].LineWidth = 2;

    // Setting up the automatic loop
    sc.AutoLoop = 1;

    return;
  }

  // Accessing TICK-SP data
  const char* symbol = "TICK-SP";
  s_SCBasicSymbolData symbolData;

  sc.GetBasicSymbolData(symbol, symbolData, true);

  float tickValue = symbolData.LastTradePrice;
  
  sc.Subgraph[0][sc.Index] = tickValue;

  if (tickValue == 0)
  {
    // Error handling if data cannot be obtained
    sc.AddMessageToLog("Error: Could not get TICK-SP data.", 1);
  }
}