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.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 POL : Strategy { #region Variables // Wizard generated variables private double pT = 2.000; // Default setting for PT private double sL = 2.000; // Default setting for SL // 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() { SetProfitTarget("", CalculationMode.Percent, PT); SetStopLoss("", CalculationMode.Percent, SL, true); CalculateOnBarClose = true; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition set 1 if (Close[0] > Close[10]) { EnterLong(DefaultQuantity, ""); } } #region Properties [Description("profit target")] [GridCategory("Parameters")] public double PT { get { return pT; } set { pT = Math.Max(1, value); } } [Description("stop-loss")] [GridCategory("Parameters")] public double SL { get { return sL; } set { sL = Math.Max(1, value); } } #endregion } }
Comment