Login Page - Create Account

Support Board


Date/Time: Sat, 27 Apr 2024 12:57:01 +0000



Creating a function within a custom study

View Count: 1170

[2016-10-07 21:47:03]
bala - Posts: 74
Objective: Need to draw a marker a few times in a study. Currently writing 10 or so lines for each time I draw. Can I declare a function within the study to draw a marker and call that function?

Is the following scenario possible?


+++++++++++++++++
#include "sierrachart.h"
#include "scstudyfunctions.h"  {
SCSFExport scsf_Mytest2(SCStudyGraphRef sc)
{if (sc.SetDefaults)
  {}

int drawmymarker(parameters)
{use sc_tool
....
....
return 0;
}

++++++++++++++++++++++++++++++++++

//main study

if condition {
drawmarker(parameters):
}
[2016-10-10 09:35:24]
Sierra Chart Engineering - Posts: 104368
Refer to:
ACSIL Programming Concepts: Passing ACSIL Interface Members Structure To Secondary Function
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
[2016-10-11 22:12:00]
bala - Posts: 74
Thanks for the example, this shows the function but no parameters in the called function.

void PassingSCStrutureExampleFunction(SCStudyInterfaceRef sc)
{
  //The "sc" structure can be used anywhere within this function.
}

If I want to call the "PassingSCStrutureExampleFunction" with a parameter how do I define it?

(PLEASE NOTE THAT THIS IS NOT A PROGRAMING HELP BUT FEATURE AND DOCUMENTATION HELP)
[2016-10-12 01:00:47]
Sierra Chart Engineering - Posts: 104368
Functions are explained here:
C++ Functions
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
[2016-10-12 01:12:22]
ejtrader - Posts: 688
Bala - You can use the following pseudo code as an example.



void PassingSCStrutureExampleFunction(SCStudyInterfaceRef sc)
{
......
return;
}

SCSFExport scsf_Mytest2(SCStudyInterfaceRef sc)
{
....
..
PassingSCStrutureExampleFunction(sc);
...
return;
}

Date Time Of Last Edit: 2016-10-12 01:15:02
[2016-10-12 10:59:09]
bala - Posts: 74
Hi,

Not what I was looking for..? / In youer example no paramaters are passsed...plese see below an imaginary example


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int calctest(SCStudyInterfaceRef sc, int testsum)
{
  int testsum2;
  testsum2=testsum*1000;
  return testsum2;
}
CSFExport scsf_Mytest2(SCStudyInterfaceRef sc)

{

....

..

Calctest(testsum);

...

return;

}
[2016-10-12 17:15:56]
Sierra Chart Engineering - Posts: 104368
Functions are explained here:
C++ Functions
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

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

Login

Login Page - Create Account