here my thoughts:
I want enter the market manually by limit order without any stopp order to protect the position.. - no problem so far.
After I have an position in the market I want to activate a stratgie which adjusted added a stopp to protect the position. The adjusting stopp follows the Parabolic indicator.
But it does'nt work I read the tutorial and example, nothing helps.
Here are so code:
#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>
/// Long Exit nach Parabolic
/// </summary>
[Description("Long Exit nach Parabolic")]
public class ParabolicStopLong : Strategy
{
#region Variables
// Wizard generated variables
private int periode = 1; // Default setting for Periode
// 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()
{
Add(ParabolicSAR(Median, 0.02, 0.2, 0.02));
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Median[0] < ParabolicSAR(Median, 0.02, 0.2, 0.02)[0])
{
ExitLong("Exit", "");
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int Periode
{
get { return periode; }
set { periode = Math.Max(1, value); }
}
#endregion
}
}

Comment