using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Serialization;
using AgenaTrader.Custom;
using AgenaTrader.Plugins;
using AgenaTrader.Helper;
namespace AgenaTrader.UserCode
[Description("Enter the description for the new custom indicator here")]
public class MyIndicator : UserIndicator
protected override void OnInit()
// Two blue lines will be placed into the chart, one at 70 and the other at 30
AddLine(new LevelLine(Color.Blue, 70, "UpperLine"));
AddLine(new LevelLine(Color.Blue, 30, "LowerLine"));
AddOutput(new OutputDescriptor(Color.FromKnownColor(KnownColor.Red), "FastSMA"));
AddOutput(new OutputDescriptor(Color.FromKnownColor(KnownColor.Blue), "SlowSMA"));
protected override void OnCalculate()
//The set method is assigned to the value of the current bar
FastSMA.Set( SMA(8)[0] ); // is identical with Outputs[0].Set( SMA(8)[0] );
SlowSMA.Set( SMA(50)[0] ); // is identical with Outputs[1].Set( SMA(50)[0] );
// Two data series are made available here
// These are not necessary for the display of the indicator // With the help of these series, one indicator can access the other
// For example: double d = MyIndicator.FastSMA[0] - MyIndicator.SlowSMA[0];
public DataSeries FastSMA
get { return Outputs[0]; }
public DataSeries SlowSMA
get { return Outputs[1]; }