NexusFi: Find Your Edge


Home Menu

 





SierraChart coding help (error compiling)


Discussion in Sierra Chart

Updated
    1. trending_up 1,396 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
hhomsi8
Stockholm, Sweden
 
Posts: 10 since Feb 2023
Thanks Given: 7
Thanks Received: 0

Hi, I am new to coding, I have developed a momentum indicator in EasyLanguage for TradeStation (simple one really). and Now that I want to move to SierraChart, I faced problem trying to replicate the code for ACSIL

Here is my EasyLanguage code:

HTML Code:
inputs: 
double length(14), 
double calcLength(5), 
double smoothLength(3);

vars: 
double s(0), 
double MA(0), 
double Main(0), 
double Signal(0), 
double ss(0),
double len(0);

len = length;

s = 0;
for ss = 0 to (len - 1) begin
	if close > open[ss] then s = s + 1;
	if close < open[ss] then s = s - 1;
	//else s = 0;
	 

end;

MA = XAverage(s, calcLength);
Main = XAverage(MA, smoothLength);
Signal = XAverage(Main, smoothLength);

plot1(Main, "Main", iff(Main > Signal, green, red));
plot2(Signal, "Signal", iff(Main > Signal, green, red));
plot3(0, "ZeroLine", Darkgray);

plot4(length, "UpperLine", red);
plot5(-length, "LowerLine", green);

plot6(length * 0.8, "Overbought", red);
plot7(-length * 0.8, "Oversold", green);


And Here is my endless trial of replicating it to SierraChart ACSIL, I really appreciate any help cause I am going nuts with this thingy

HTML Code:
SCDLLName("TrueMomentum_H")

SCSFExport scsf_TrueMomentum_H(SCStudyInterfaceRef sc)
{
	SCSubgraphRef Subgraph_Main = sc.Subgraph[0];
	SCSubgraphRef Subgraph_Signal = sc.Subgraph[1];
	SCSubgraphRef Subgraph_ZeroLine = sc.Subgraph[2];
	SCSubgraphRef Subgraph_UpperLine = sc.Subgraph[3];
	SCSubgraphRef Subgraph_LowerLine = sc.Subgraph[4];
	SCSubgraphRef Subgraph_Overbought = sc.Subgraph[5];
	SCSubgraphRef Subgraph_Oversold = sc.Subgraph[6];

	SCInputRef Input_Length = sc.Input[0];
	SCInputRef Input_CalcLength = sc.Input[1];
	SCInputRef Input_SmoothLength = sc.Input[2];

	if (sc.SetDefaults)
	{
		sc.GraphName = "#MyTrueMomentum";

		sc.GraphRegion = 0;
		sc.ValueFormat = 2;
		sc.AutoLoop = 1;

		Subgraph_Main.Name = "Main";
		Subgraph_Main.DrawStyle = DRAWSTYLE_LINE;
		Subgraph_Main.PrimaryColor = RGB(0, 255, 0);
		Subgraph_Main.SecondaryColor = RGB(255, 0, 0);
		Subgraph_Main.SecondaryColorUsed = true;
		Subgraph_Main.DrawZeros = false;

		Subgraph_Signal.Name = "Signal";
		Subgraph_Signal.DrawStyle = DRAWSTYLE_LINE;
		Subgraph_Signal.PrimaryColor = RGB(0, 255, 0);
		Subgraph_Signal.SecondaryColor = RGB(255, 0, 0);
		Subgraph_Signal.SecondaryColorUsed = true;
		Subgraph_Signal.DrawZeros = false;

		Subgraph_ZeroLine.Name = "ZeroLine";
		Subgraph_ZeroLine.DrawStyle = DRAWSTYLE_LINE;
		Subgraph_ZeroLine.PrimaryColor = RGB(169, 169, 169);
		Subgraph_ZeroLine.DrawZeros = true;

		Subgraph_UpperLine.Name = "UpperLine";
		Subgraph_UpperLine.DrawStyle = DRAWSTYLE_LINE;
		Subgraph_UpperLine.PrimaryColor = RGB(255, 0, 0);
		Subgraph_UpperLine.DrawZeros = false;

		Subgraph_LowerLine.Name = "LowerLine";
		Subgraph_LowerLine.DrawStyle = DRAWSTYLE_LINE;
		Subgraph_LowerLine.PrimaryColor = RGB(0, 255, 0);
		Subgraph_LowerLine.DrawZeros = false;

		Subgraph_Overbought.Name = "Overbought";
		Subgraph_Overbought.DrawStyle = DRAWSTYLE_LINE;
		Subgraph_Overbought.PrimaryColor = RGB(255, 0, 0);
		Subgraph_Overbought.DrawZeros = false;

		Subgraph_Oversold.Name = "Oversold";
		Subgraph_Oversold.DrawStyle = DRAWSTYLE_LINE;
		Subgraph_Oversold.PrimaryColor = RGB(0, 255, 0);
		Subgraph_Oversold.DrawZeros = false;

		Input_Length.Name = "Length";
		Input_Length.SetInt(14);
		Input_Length.SetIntLimits(1, MAX_STUDY_LENGTH);

		Input_CalcLength.Name = "Calculation Length";
		Input_CalcLength.SetInt(5);
		Input_CalcLength.SetIntLimits(1, MAX_STUDY_LENGTH);

		Input_SmoothLength.Name = "Smooth Length";
		Input_SmoothLength.SetInt(3);
		Input_SmoothLength.SetIntLimits(1, MAX_STUDY_LENGTH);

		return;
	}

	int len = Input_Length.GetInt();
	SCFloatArrayRef s = sc.Subgraph[7]; // Create an array to store 's' values
	SCFloatArrayRef MA = sc.Subgraph[8]; // Create an array to store 'MA' values
	SCFloatArrayRef Main = sc.Subgraph[9]; // Create an array to store 'Main' values
	SCFloatArrayRef Signal = sc.Subgraph[10]; // Create an array to store 'Signal' values

	s[sc.Index] = 0;
	for (int ss = 0; ss < len; ss++)
	{
		if (sc.Close[sc.Index] > sc.Open[sc.Index - ss])
			s[sc.Index] = s[sc.Index] + 1;
		else if (sc.Close[sc.Index] < sc.Open[sc.Index - ss])
			s[sc.Index] = s[sc.Index] - 1;
		//else
		//	s[sc.Index] = 0;
	}

	MA[sc.Index] = sc.SimpleMovAvg(s, Input_CalcLength.GetInt());
	Main[sc.Index] = sc.SimpleMovAvg(MA, Input_SmoothLength.GetInt());
	Signal[sc.Index] = sc.SimpleMovAvg(Main, Input_SmoothLength.GetInt());

	Subgraph_Main[sc.Index] = Main[sc.Index];
	Subgraph_Signal[sc.Index] = Signal[sc.Index];
	Subgraph_ZeroLine[sc.Index] = 0;
	Subgraph_UpperLine[sc.Index] = len;
	Subgraph_LowerLine[sc.Index] = -len;
	Subgraph_Overbought[sc.Index] = len * 0.8;
	Subgraph_Oversold[sc.Index] = -len * 0.8;
}


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
White House Drops First Alien Files Today -- Market Says …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
Iran Airspace Contract Surges to 33.5% as Project Freedo …
Prediction Markets & Event Contracts
Ninjatrader users - good CONNECTIONs post and article fr …
NinjaTrader
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks
  #2 (permalink)
 Trembling Hand 
Melbourne, Land of Oz
 
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 249 since Jun 2011
Thanks Given: 30
Thanks Received: 369

What does the error say?


Follow me on X Reply With Quote
Thanked by:
  #3 (permalink)
hhomsi8
Stockholm, Sweden
 
Posts: 10 since Feb 2023
Thanks Given: 7
Thanks Received: 0


I am getting this error lists:

HTML Code:
-- Starting remote build of Custom Studies Source files: TrueMomentum_H.cpp. 64-bit --     14:17:12

Allow time for the server to compile the files and build the DLL.

The remote build did not succeed. Result:

TrueMomentum_H.cpp: In function 'void scsf_TrueMomentum_H(SCStudyInterfaceRef)':
TrueMomentum_H.cpp:105:61: error: no matching function for call to 's_sc::SimpleMovAvg(c_ArrayWrapper<float>&, int)'
  105 |  MA[sc.Index] = sc.SimpleMovAvg(s, Input_CalcLength.GetInt());
      |                                                             ^
In file included from TrueMomentum_H.cpp:2:
sierrachart.h:1253:18: note: candidate: 'c_ArrayWrapper<float>& s_sc::SimpleMovAvg(SCFloatArrayRef, SCFloatArrayRef, int, int)'
 1253 |  SCFloatArrayRef SimpleMovAvg(SCFloatArrayRef In, SCFloatArrayRef Out, int Index, int Length)
      |                  ^~~~~~~~~~~~
sierrachart.h:1253:18: note:   candidate expects 4 arguments, 2 provided
sierrachart.h:1257:18: note: candidate: 'c_ArrayWrapper<float>& s_sc::SimpleMovAvg(SCFloatArrayRef, SCFloatArrayRef, int)'
 1257 |  SCFloatArrayRef SimpleMovAvg(SCFloatArrayRef In, SCFloatArrayRef Out, int Length)
      |                  ^~~~~~~~~~~~
sierrachart.h:1257:18: note:   candidate expects 3 arguments, 2 provided
TrueMomentum_H.cpp:106:66: error: no matching function for call to 's_sc::SimpleMovAvg(c_ArrayWrapper<float>&, int)'
  106 |  Main[sc.Index] = sc.SimpleMovAvg(MA, Input_SmoothLength.GetInt());
      |                                                                  ^
In file included from TrueMomentum_H.cpp:2:
sierrachart.h:1253:18: note: candidate: 'c_ArrayWrapper<float>& s_sc::SimpleMovAvg(SCFloatArrayRef, SCFloatArrayRef, int, int)'
 1253 |  SCFloatArrayRef SimpleMovAvg(SCFloatArrayRef In, SCFloatArrayRef Out, int Index, int Length)
      |                  ^~~~~~~~~~~~
sierrachart.h:1253:18: note:   candidate expects 4 arguments, 2 provided
sierrachart.h:1257:18: note: candidate: 'c_ArrayWrapper<float>& s_sc::SimpleMovAvg(SCFloatArrayRef, SCFloatArrayRef, int)'
 1257 |  SCFloatArrayRef SimpleMovAvg(SCFloatArrayRef In, SCFloatArrayRef Out, int Length)
      |                  ^~~~~~~~~~~~
sierrachart.h:1257:18: note:   candidate expects 3 arguments, 2 provided
TrueMomentum_H.cpp:107:70: error: no matching function for call to 's_sc::SimpleMovAvg(c_ArrayWrapper<float>&, int)'
  107 |  Signal[sc.Index] = sc.SimpleMovAvg(Main, Input_SmoothLength.GetInt());
      |                                                                      ^
In file included from TrueMomentum_H.cpp:2:
sierrachart.h:1253:18: note: candidate: 'c_ArrayWrapper<float>& s_sc::SimpleMovAvg(SCFloatArrayRef, SCFloatArrayRef, int, int)'
 1253 |  SCFloatArrayRef SimpleMovAvg(SCFloatArrayRef In, SCFloatArrayRef Out, int Index, int Length)
      |                  ^~~~~~~~~~~~
sierrachart.h:1253:18: note:   candidate expects 4 arguments, 2 provided
sierrachart.h:1257:18: note: candidate: 'c_ArrayWrapper<float>& s_sc::SimpleMovAvg(SCFloatArrayRef, SCFloatArrayRef, int)'
 1257 |  SCFloatArrayRef SimpleMovAvg(SCFloatArrayRef In, SCFloatArrayRef Out, int Length)
      |                  ^~~~~~~~~~~~
sierrachart.h:1257:18: note:   candidate expects 3 arguments, 2 provided

-- End of Build --     14:17:17


Reply With Quote
  #4 (permalink)
 Trembling Hand 
Melbourne, Land of Oz
 
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 249 since Jun 2011
Thanks Given: 30
Thanks Received: 369


hhomsi8 View Post
sierrachart.h:1253:18: note: candidate expects 4 arguments, 2 provided
sierrachart.h:1257:18: note: candidate: 'c_ArrayWrapper<float>& s_sc::SimpleMovAvg(SCFloatArrayRef, SCFloatArrayRef, int)'
1257 | SCFloatArrayRef SimpleMovAvg(SCFloatArrayRef In, SCFloatArrayRef Out, int Length)
| ^~~~~~~~~~~~
sierrachart.h:1257:18: note: candidate expects 3 arguments, 2 provided

-- End of Build -- 14:17:17


Its telling you what is wrong with your code and what line. "note: candidate expects 3 arguments, 2 provided"

You are not providing all required parameters for each function that is throwing an error. See the specs for the Simple Moving Average here

https://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Functions.html


Follow me on X Reply With Quote
Thanked by:
  #5 (permalink)
 
Fi's Avatar
 Fi 
NexusFi
 


Trembling Hand View Post
Its telling you what is wrong with your code and what line. "note: candidate expects 3 arguments, 2 provided"

You are not providing all required parameters for each function that is throwing an error.

@Trembling Hand,

nailed it. The key thing to understand here: sc.SimpleMovAvg in ACSIL doesn't return a value -- it writes directly into an output array. That's a at heart different pattern than most MA functions people have used before.

Wrong (what's throwing the error):
 
Code
MA[sc.Index] = sc.SimpleMovAvg(s, Input_CalcLength.GetInt());  // 2 args, trying to capture return
Correct:
 
Code
sc.SimpleMovAvg(s, MA, Input_CalcLength.GetInt());  // 3 args, Out array is second param
The second argument IS the output. The function populates that array in place -- nothing to capture. For chaining smoothed MAs, the corrected pattern looks like:

 
Code
sc.SimpleMovAvg(s, MA, Input_CalcLength.GetInt());
sc.SimpleMovAvg(MA, Main, Input_SmoothLength.GetInt());
sc.SimpleMovAvg(Main, Signal, Input_SmoothLength.GetInt());

Subgraph_Main[sc.Index] = Main[sc.Index];
Subgraph_Signal[sc.Index] = Signal[sc.Index];
This pattern -- void function, writes to Out array, then copy to display subgraph -- is consistent across most of the sc calculation functions. Once it clicks, the rest of ACSIL gets a lot more predictable.

Full signature at Sierra Chart ACSIL Functions -- bookmark it.

Have a good weekend!

-- Fi

"In ACSIL, the output array is the return value -- it just lives somewhere you can keep reusing."


Learn more about Fi AI trading companion
IMPORTANT: I can make mistakes! Always verify data before relying on it.

Please leave feedback here. You can disable my ability to reply to your posts by placing me on your ignore list.

Fi provides educational information on a best-effort basis only. You are responsible for your own trading decisions and for verification of all data. This message is not trading advice.
Reply With Quote




Last Updated on May 23, 2026


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts