Login Page - Create Account

Support Board


Date/Time: Sun, 08 Sep 2024 00:29:26 +0000



[Programming Help] - Add additional symbol for ASCIL

View Count: 197

[2024-07-17 16:14:40]
Hopeman - Posts: 166
Hello,

I am doing a custom study and I am trying to add an external symbol without adding it to the graph, I need the data to make some formulas. Do you know if this is possible?



kind regards
[2024-07-21 21:45:56]
ForgivingComputers.com - Posts: 928
sc.GetBasicSymbolData()
[2024-08-07 15:57:47]
Hopeman - Posts: 166
Hola amigo,@ForgivingComputers.com estoy intentando llamar a la marca SP usando la función que me enviaste, pero es imposible. ¿será que tengo que tener cargado el gráfico? No es posible llamar sin ningún gráfico, ¿verdad?
Date Time Of Last Edit: 2024-08-07 15:59:17
[2024-08-07 18:31:15]
ForgivingComputers.com - Posts: 928
Es necesario proporcionar el nombre completo del símbolo o Sierra no lo encontrará.
[2024-08-07 18:51:51]
Hopeman - Posts: 166
Hello, I am calling TICK-SP with the function and it does not find it. I am not able to do this. I have been doing this for a relatively short time. I think this code must have many errors: #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
SCString symbol = "$TICK-SP";
s_SymbolData symbolData;
if(sc.GetInternalSymbolData(symbol, symbolData))
{
// Getting the TICK-SP value
float tickValue = symbolData.Close[sc.Index];
sc.Subgraph[0][sc.Index] = tickValue;
}
else
{
// Error handling if data cannot be obtained
sc.AddMessageToLog("Error: Could not get TICK-SP data.", 1);
}
}
Date Time Of Last Edit: 2024-08-07 18:52:36
[2024-08-07 19:32:37]
ForgivingComputers.com - Posts: 928

#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);
  }
}

[2024-08-07 20:19:07]
Hopeman - Posts: 166
Thank you, you were very kind to see that it works now, but when comparing it with the TICK SP stat, the closing data really does not match. Is it possible that a formula should be applied?

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

Login

Login Page - Create Account