I want to programm a ninjascript auto trader.
I start script and see two blue horizontal lines a buy line and a sell line.
I can move lines with mouse up and down but buy line > sell line is clear.
I have a button for start/stop trading.
If ask price goes over buy line then close all orders and entry long order.
contractnumber = contractnumber*2; count++;
If bid price goes under sell line then close all orders and entry short order.
contractnumber = contractnumber*2; count++;
if ( count == 6 ) close all and stop is better

Can anyone give me some hints / examples for programming this.
I have the following code for the wizzard but it crashed.
#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>
/// Egal
/// </summary>
[Description("Egal")]
public class my002Test : Strategy
{
#region Variables
// Wizard generated variables
private int buyline = 1; // Default setting for Buyline
private int sellline = 1; // Default setting for Sellline
private int myQuantity = 1; // Default setting for MyQuantity
private int extra2 = 1; // Default setting for Extra2
// 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;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (GetCurrentAsk() >= Buyline)
{
EnterLongLimit(MyQuantity, MyQuantity+3, "");
MyQuantity*=2;
}
// Condition set 2
if (GetCurrentBid() <= Sellline)
{
EnterShortLimit(MyQuantity, MyQuantity-3, "");
MyQuantity*=2;
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int Buyline
{
get { return buyline; }
set { buyline = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int Sellline
{
get { return sellline; }
set { sellline = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int MyQuantity
{
get { return myQuantity; }
set { myQuantity = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int Extra2
{
get { return extra2; }
set { extra2 = Math.Max(1, value); }
}
#endregion
}
}

Comment