The daily highs and lows show up correctly in the Output window though.
Im running 6.5 on windows XP, connected to TWS.
The ORB that I modified it from works fine....
any help would be much appreciated.
Thanks.
//
// Copyright (C) 2007, NinjaTrader LLC <[URL="http://www.ninjatrader.com"]www.ninjatrader.com[/URL]>.
// NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
//
#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.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Simple strategy that monitors for a breakout.
/// </summary>
[Description("Simple strategy that monitors for a breakout.")]
public class AfternoonBreak: Strategy
{
#region Variables
private double highestHigh = 0;
private double lowestLow = 0;
#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;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Resets the highest high and lowest low at the start of every new session
if (Bars.FirstBarOfSession && FirstTickOfBar)
{
highestHigh = High[0];
lowestLow = Low[0];
}
// Stores the highest high from the morning session on a 30 minute chart
if (Bars.BarsSinceSession < 7 && High[0] > highestHigh)
highestHigh = High[0];
// Stores the lowest low from the morning session on a 30 minute chart
if (Bars.BarsSinceSession < 7 && Low[0] < lowestLow)
lowestLow = Low[0];
// Prints details in the output window to follow for confirmation
Print(Instrument.FullName + " " + Time[0] + " " + CurrentBar + " " + highestHigh + " " + lowestLow);
Print(Bars.BarsSinceSession);
// Draw the bar count on the chart
DrawText(CurrentBar.ToString(),Bars.BarsSinceSession.ToString(),0,High[0] + (TickSize *3),Color.Blue);
//Print the symbol and Highs and Lows of the morning session
if (Bars.BarsSinceSession == 6 )
PrintWithTimeStamp(Instrument.FullName + " " + "High" + " " + highestHigh + " " + "Low" + lowestLow);
//Setup the Stop in the direction of close to the high/low midpoint
if (Bars.BarsSinceSession >= 6 && Close[0] > (highestHigh + lowestLow)/2)
//Enter Long at highest high + 1 of Morning Session.
EnterLongStop(100, highestHigh + TickSize, "");
//} PrintWithTimeStamp(Instrument.FullName + " " +)
else if (Bars.BarsSinceSession >= 6 && Close[0] < (highestHigh + lowestLow)/2)
//Enter Short at lowest low - 1 of Morning Session.
EnterShortStop(100, lowestLow - TickSize, "");
}
}
}

Comment