I have a demo live feed with Proactive Futures zen fire and the simulated feed from Ninja.
Just to get my feet wet I took the SampleMovingAverageCrossover strategy and modified it, compiled it and saved it as a new strategy (MaCrossover) only changing the fast and slow values to generate some fast trades.
I set up the indicator ZN 03-11, selected the demo feed, loaded the strategy and activated it. I set the trend to rise fast and expected to see it make an order. No such luck.
I have read what I could find in the online manual but no amount of playing will get it to make a trade.
Can someone point me to a thread or something so I can find out what I am not doing?
Here is the strategy I'm using. If I can get this thing to trade I will be good.
thanks
//
#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 moving average cross over strategy.
/// </summary>
[Description("moving average cross over strategy.")]
public class MACrossOver : Strategy
{
#region Variables
private int fast = 5;
private int slow = 25;
#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()
{
SMA(Fast).Plots[0].Pen.Color = Color.Orange;
SMA(Slow).Plots[0].Pen.Color = Color.Green;
Add(SMA(Fast));
Add(SMA(Slow));
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick).
/// </summary>
protected override void OnBarUpdate()
{
if (CrossAbove(SMA(Fast), SMA(Slow), 1))
EnterLong(1);
else if (CrossBelow(SMA(Fast), SMA(Slow), 1))
EnterShort(1);
}
#region Properties
/// <summary>
/// </summary>
[Description("Period for fast MA")]
[GridCategory("Parameters")]
public int Fast
{
get { return fast; }
set { fast = Math.Max(1, value); }
}
/// <summary>
/// </summary>
[Description("Period for slow MA")]
[GridCategory("Parameters")]
public int Slow
{
get { return slow; }
set { slow = Math.Max(1, value); }
}
#endregion
}
}
Comment