Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 08:29:19 +0000



[Programming Help] - basic acsil - how to write message to a log (from within CustomChartBarFunction)

View Count: 2527

[2019-11-06 16:13:03]
ochocinco - Posts: 29
This is a basic acsil help request. Im certain there is a simple concept I'm missing.
What is the right way to add a message to a log from within the "CustomFunction" function?

Im using Remote Build. The output is:

debug_test.cpp: In function 'void CustomFunction(SCCustomChartBarInterfaceRef)':
debug_test.cpp:10:4: error: 'sc' was not declared in this scope
sc.AddMessageToLog(DebugMessage, 0);
^

This code below is only used as a compile test, not to actually build custom chart bars.


#include "sierrachart.h"
SCDLLName("debug example")
SCSFExport CustomFunction(SCCustomChartBarInterfaceRef ChartBarInterface)
{
ChartBarInterface.StartNewBarFlag = 0;
if (ChartBarInterface.IsDeterminingIfShouldStartNewBar)
{
SCString DebugMessage;
DebugMessage.Format("Hello World #1");
sc.AddMessageToLog(DebugMessage, 0);
return;
}
}
SCSFExport scsf_CustomChartBarsExample(SCStudyInterfaceRef sc)
{
if (sc.SetDefaults)
{
// This function is called from another thread.
sc.fp_ACSCustomChartBarFunction = CustomFunction;
sc.AutoLoop = 0;//Always use manual looping.
return;
}
}

thanks for your consideration,
[2019-11-07 10:23:45]
User907968 - Posts: 802
The function needs to be passed reference to sc structure -
ACSIL Programming Concepts: Passing ACSIL Interface Members Structure To Secondary Function

But, for CustomChartBarFunction, I don't think this is possible.
sc.fp_ACSCustomChartBarFunction expects pointer to function only one variable 'SCCustomChartBarInterfaceRef'
[2019-11-07 10:36:20]
ochocinco - Posts: 29
I'd wondered about that. Thanks very much for taking the time to reply.
[2019-11-08 01:33:26]
Sierra Chart Engineering - Posts: 104368
This function:
sc.AddMessageToLog

Is not contained within:
SCCustomChartBarInterfaceRef

Although we could add it.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2019-11-08 12:12:00]
ochocinco - Posts: 29
I'm trying to debug my custom chart bars code, so if the AddMessageToLog function can be added within SCCustomChartBarInterfaceRef that would be great.
[2020-06-01 05:53:41]
User806682 - Posts: 10
Just following up on this thread.
I see this member function isn't yet available in SCCustomChartBarInterfaceRef.
Could you guys please add AddMessageToLog please?

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

Login

Login Page - Create Account