
I have attached a simple Strategy, made to guarantee that there will be "Exit on Close" orders, and to print some data about all executions. The output shows many orders being successfully queried and reported, but not a single order named "Exit on close". Was this a design decision that some executions cannot be queried even by name?
#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 ExitOnCloseTest : Strategy
{
#region Variables
#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 = true;
ExitOnClose = true;
ClearOutputWindow();
DefaultQuantity = 100;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar < 1) return;
if (Close[1] > Open[1] && Close[0] > Open[0]) EnterLong(DefaultQuantity, "LongEntry");
if (Close[1] < Open[1] && Close[0] < Open[0]) EnterShort(DefaultQuantity, "ShortEntry");
}
protected override void OnExecution(IExecution execution)
{
if (execution.Order != null)
{
Print("*************************");
Print("Execution Time: " + execution.Order.Time);
Print("Execution Name: " + execution.Order.Name);
Print("*************************");
}
}
#region Properties
#endregion
}
}


Comment