pass parameters from Signal to Function

Questions about MultiCharts .NET and user contributed studies.
viresearch
Posts: 12
Joined: 21 Mar 2013

pass parameters from Signal to Function

Postby viresearch » 12 May 2013

Sometimes we define a Function, and pass parameters from Signal to Function. Moreover, Function return values to Signal. How can do these things? May you give some examples?
I find public ISeries<Double> price { get; set; }
public Int32 length { get; set; }
It seems these two get values from Signals.

protected override double CalcBar(){
if (Bars.CurrentBar == 1) return price.Value;
double prev = this[1];
return prev + m_smoothingfactor * (price.Value - prev);
}
this one will return values each time when it visit a bar.

what are ISeries<Double> and public Int32?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: pass parameters from Signal to Function

Postby Henry MultiСharts » 13 May 2013

Hello viresearch,

ISeries is a base interface for functions, series variables, and price series. It provides access to historical values of inherited objects.

Please visit MSDN to learn about Int32

viresearch
Posts: 12
Joined: 21 Mar 2013

Re: pass parameters from Signal to Function

Postby viresearch » 13 May 2013

Now the problem is how to use Signal to call Function and pass parameters to them.
May you give me an example to use a Signal to call Function namespace PowerLanguage.Function
{ public class XAverageOrig : FunctionSeries<Double>

and how to pass parameters to public ISeries<Double> price { get; set; }
public Int32 length { get; set; }

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: pass parameters from Signal to Function

Postby Henry MultiСharts » 15 May 2013

viresearch, this is a general C# question, not related to MultiCharts .Net. Function, Signal and Indicator are abstract "forms" we have added for ease of use. The heart of any study in MC .Net is a class, like in regular C#. You can search the Internet to learn how it works and how to utilize it. You can also find code examples in the source code of the prebuilt MultiCharts studies (PowerLanguage .Net Editor->File tab->Open).


Return to “MultiCharts .NET”