About‎ > ‎

.NET method called from AFL with parameters

AFL code

Period = Param("Period", 10, 5, 50, 5);

// getting the value calculated by the plug-in method using the input parameters from the AFL
MySlowMa = BasicSampleCS3(Close, Period);     // see BasicSampleCS3() method in "Basic Samples.cs" for source

Plot(MySlowMa , "MySlowMa ", colorRed,  styleLine);

Title = _SECTION_NAME() +", Number of bars:" + NumToStr(BarCount, 1.0);

 

.NET code

[ABMethod]
public ATArray BasicSampleCS3(ATArray array, float period)
{
     ATArray myEma = AFAvg.Ema(array, period);
     return myEma;
}