I have a 1500 tick bar chart as my primary chart. A 4500 tick bar chart is my secondary chart. I have the DM(14) indicator on both charts. While running market replay data for the ES contract the output values on the secondary chart do not correspond with indicator on the 4500 tick bar graph. Run the strategy below in the primary 1500 tick bar chart and observe the output window with secondary chart values. Please confirm they do not correspond. If so, why?
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class DMADXError : Strategy
{
#region Variables
private double myDMPrimaryChart = 0;
private double myDMSecondaryChart = 0;
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = false;
TraceOrders = true;
Add(PeriodType.Tick, 4500);
BarsRequired = 3;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired)
return;
if(BarsInProgress != 0)
return;
myDMPrimaryChart = DM(14)[0];
myDMSecondaryChart = DM(BarsArray[1], 14)[0];
Print("DM Primary Chart = " + myDMPrimaryChart.ToString());
Print("DM Seconday Chart = " + myDMSecondaryChart.ToString());
}
}
}
Comment