Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Scale Out Partials

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Scale Out Partials

    I would like to send 2 contracts with a target for the 1st and another target for the 2nd.

    I'm using ER2 06-07

    Here is the code that the wizard produced:



    #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>

    /// Scale out 1st target and 2nd target

    ///</summary>

    [Description(
    "Scale out 1st target and 2nd target")]

    [Gui.Design.DisplayName(
    "MultCars")]

    publicclass MultContracts : Strategy

    {

    #region Variables

    // Wizard generated variables

    // 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>

    protectedoverridevoid Initialize()

    {

    SetProfitTarget(
    "T1", CalculationMode.Ticks, 10);

    SetProfitTarget(
    "T2", CalculationMode.Ticks, 15);

    CalculateOnBarClose =
    true;

    }

    ///<summary>

    /// Called on each bar update event (incoming tick)

    ///</summary>

    protectedoverridevoid OnBarUpdate()

    {

    // Condition set 1

    if (ToDay(Time[0]) == ToDay(2007, 5, 3)

    && ToTime(Time[
    0]) > ToTime(7, 15, 0)

    && ToTime(Time[
    0]) < ToTime(7, 30, 0))

    {

    EnterLongStop(
    1, High[0], "T1");

    EnterLongStop(
    1, High[0], "T2");

    }

    }

    #region Properties

    #endregion

    }

    }
    The output is attached. As you can see it doesn't work.

    Any ideas on how to do scaling of multiple contracts?


    Attached Files

    #2
    This does work, you likely have not set the parameter "Entry handling" to "UniqueEntries" when running a backtest.

    PS - Make sure "Entries per direction" remains at a value of 1.
    RayNinjaTrader Customer Service

    Comment


      #3
      Works !

      Originally posted by NinjaTrader_Ray View Post
      This does work, you likely have not set the parameter "Entry handling" to "UniqueEntries" when running a backtest.

      PS - Make sure "Entries per direction" remains at a value of 1.
      >> That was all it needed.. THANKS

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      59 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X