I have attempted to turn the TRIX indicator into a MTF using DataSeries. I put the TRIX on an ES 7500 Volume Chart. Then I put the following code on the ES 2500 Volume chart. The OutputWindow from this code does not match the Data Window from the 7500 Chart. The Bar time stamps and the Inputs[0] do match but the indicator values do not. Can you tell me where this thing went off the rails. Help would be much appreciated because I am lost. Probably something super simple and I will be wearing a dunce cap.
#region Variables
private int signalPeriod = 3;
private DataSeries Default;
private DataSeries Signal;
private PeriodType chartType = PeriodType.Volume;
private int chartInterval = 7500;
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
// Add Secondary Chart. Bars Array 1
Add(ChartType, ChartInterval);
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (Default == null)
{
Signal = new DataSeries(SMA(BarsArray[1], 2));
{
{
return;
EMA tripleEma = EMA(EMA(EMA(Inputs[0], Period), Period), Period);
double trix = 100 * ((tripleEma[0] - tripleEma[1]) / tripleEma[0]);
Default.Set(trix);
Signal.Set(EMA(Default, SignalPeriod)[0]);
#region Properties
[GridCategory("Parameters")]
public int Period
{
set { period = Math.Max(1, value); }
[Description("Period for the signal line.")]
[GridCategory("Parameters")]
[Gui.Design.DisplayNameAttribute("Signal period")]
public int SignalPeriod
set { signalPeriod = Math.Max(1, value); }
[Description("")]
[GridCategory("Parameters")]
[Gui.Design.DisplayNameAttribute("Chart Type")]
public PeriodType ChartType
{
set { chartType = value; }
[Description("")]
[GridCategory("Parameters")]
[Gui.Design.DisplayNameAttribute("Bar Period")]
public int ChartInterval
{
set { chartInterval = Math.Max(1, value); }