Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 20:47:39 +0000



Post From: ACSIL : How can I use sc.UseTool() in an external function ?

[2013-04-11 13:11:46]
SoundsLikeSun - Posts: 30
Hi,

I have a main study with several external functions (void / int etc.). I would like to export sc.UseTool to an external function because it takes lots of code space.

However, the compiler doesn't recognize sc functions
Here is the error I get :

In function 'void Visualisator_Create(int, int, float, int)':
C:\SierraChart\ACS_Source\TcVisualisatorModules.h:10:27: error: 'sc' was not declared in this scope

And below is my code.

Thank you very much for your help

Thomas

PS : Knowing how to use sierra charts functions outside the main study would be of great help.



#include "sierrachart.h"

void Visualisator_Create(int abcde_f,
             int Current_Trade_Direction_f,
             float Trade_ProfitOrLoss_In_Points_f,
             int Visualisator_Mode)
            
{

  SCFloatArrayRef High_f = sc.BaseData[SC_HIGH];
  SCFloatArrayRef Low_f = sc.BaseData[SC_LOW];
  s_UseTool Visualisator1;


  if (Visualisator_Mode == 1)
  {
    int Visualisator1_LineNumber = 3556789;
    
    Visualisator1.Clear();
    Visualisator1.ChartNumber = sc.ChartNumber;
    Visualisator1.DrawingType = DRAWING_TEXT;
    Visualisator1.LineNumber = Visualisator1_LineNumber + abcde_f;
    Visualisator1.BeginDateTime = sc.BaseDateTimeIn[abcde_f-4];
    Visualisator1.AddMethod = UTAM_ADD_OR_ADJUST;
    Visualisator1.FontBold = 1;
    Visualisator1.FontBackColor = RGB(164,164,164);
    Visualisator1.Color = RGB(215,0,0);
    
    if (Trade_ProfitOrLoss_In_Points_f>0)
      Visualisator1.Text.Format("+%.1f pts",Trade_ProfitOrLoss_In_Points_f);    
    else
      Visualisator1.Text.Format("%.1f pts",Trade_ProfitOrLoss_In_Points_f);  

    if (Current_Trade_Direction_f>0)
      Visualisator1.BeginValue = High_f[abcde_f] + 15* sc.TickSize;
    else
      Visualisator1.BeginValue = Low_f[abcde_f] - 15* sc.TickSize;        
      
    sc.UseTool(Visualisator1);
  }
  
}