During backtesting different strategies I ran into fills I simply could not understand when using 1440min bars as primary and 5-60min as secondary.
So I created this testscript to understand the problem but it is still showing up and I cannot understand it. Maybe someone can help.
The strategy is attached and when I run it on 6S 06-11 dates 1.february forward I get a fill like in the attached pic. 77ticks above the level.
Thanks for any help.
#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 intrabarteststrat : Strategy
{
#region Variables
// Wizard generated variables
private double longlevel = 1.070; // Default setting for Longlevel
// 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 = true;
Add(PeriodType.Minute,5);
ExitOnClose=false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// if (BarsInProgress == 1) {
if (Close[0] > Longlevel)
{
EnterLong(1,DefaultQuantity, "long");
}
// }
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public double Longlevel
{
get { return longlevel; }
set { longlevel = Math.Max(1, value); }
}
#endregion
}
}

Comment