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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X