Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trading 3 Cars

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

    Trading 3 Cars

    Hello.... I am new to all this.. And i need some help with Exits after i Enter with 3 cars..

    This is what i am working on. Could someone show me what i need to do???? Thank You
    __________________________________________________ _____


    public class MarcOgreenTest3 : Strategy
    {
    #region Variables
    // Wizard generated variables
    private int myInput0 = 1; // Default setting for MyInput0
    // 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(AaIchimokuNT7(20, 14, 9, 26, 52));
    Add(AaIchimokuNT7(20, 14, 9, 26, 52));
    Add(AaIchimokuNT7(20, 14, 9, 26, 52));
    Add(AaIchimokuNT7(20, 14, 9, 26, 52));
    SetStopLoss("FSO", CalculationMode.Ticks, 16, false);

    CalculateOnBarClose = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (Time[0].DayOfWeek != DayOfWeek.Monday && Time[0].DayOfWeek != DayOfWeek.Friday)
    if ((ToTime(Time[0]) >= 83000 && ToTime(Time[0]) < 120000) || (ToTime(Time[0]) >= 140000 && ToTime(Time[0]) < 154500))

    if (CrossAbove(AaIchimokuNT7(20, 14, 9, 26, 52).KijunSen, AaIchimokuNT7(20, 14, 9, 26, 52).SenkouSpanA, 1)
    && AaIchimokuNT7(20, 14, 9, 26, 52).ChikouSpan[26] > High[26])
    {
    EnterLong(3, "enter long ");
    }

    // Condition set 2
    if (Low[0] <= AaIchimokuNT7(20, 14, 9, 26, 52).SenkouSpanA[0])
    {
    ExitLong("Trail Stop Cloud", "");
    }
    }

    #region Properties
    [Description("")]
    [GridCategory("Parameters")]
    public int MyInput0
    {
    get { return myInput0; }
    set { myInput0 = Math.Max(1, value); }
    }
    #endregion
    }

    #2
    I didnt put in that i wanted to Exit 1 car at + 8tic from Entry... Exit car 2 at 16 tic from Entry... and the last car,,, I wanted to use this,,, If Price Close Below The SenkouSpanA

    Comment


      #3
      Hello,

      You can do this by using a SetProfitTarget with a unique tag for each order.

      Please take a look at our reference sample on Scaling out of position for an example of how to accomplish this:

      MatthewNinjaTrader Product Management

      Comment


        #4
        Thanks

        That looks to work Great.... Now i need to find a way to move my Stop up to Entry after the First Car Exit ???

        Thanks
        Marc

        Comment


          #5
          Glad that worked out for you. We also have a reference sample on Modifying the price of stop loss and profit target orders

          MatthewNinjaTrader Product Management

          Comment


            #6
            I just wanted to say thanks for all your help... I have spent hours on my own before i ask for help.. watched some videos,, But what you have did helped a TON... But now i can seem to get my stops moved after i hit first target.. Lets say i want to put on 3 cars... and take 1 off when Price is > 12 tic.... then 2nd off at 24 tic.. Then set last car with a Trail Stop

            Here is my Code.. Thanks for all you Help.

            protected override void Initialize()
            {
            Add(AaIchimokuNT7(20, 14, 9, 26, 52));
            Add(AaIchimokuNT7(20, 14, 9, 26, 52));
            Add(AaIchimokuNT7(20, 14, 9, 26, 52));
            Add(AaIchimokuNT7(20, 14, 9, 26, 52));
            Add(AaIchimokuNT7(20, 14, 9, 26, 52));
            Add(AaIchimokuNT7(20, 14, 9, 26, 52));
            Add(AaIchimokuNT7(20, 14, 9, 26, 52));
            SetStopLoss("", CalculationMode.Ticks, 24, false);

            EntriesPerDirection = 1;
            EntryHandling = EntryHandling.UniqueEntries;

            CalculateOnBarClose = true;

            SetProfitTarget("Long 1a", CalculationMode.Ticks,12);
            SetTrailStop(CalculationMode.Ticks, 2);

            SetProfitTarget("Long 2a", CalculationMode.Ticks, 24);
            SetTrailStop(CalculationMode.Ticks, 20);

            SetProfitTarget("Long 3a", CalculationMode.Ticks, 40);
            SetTrailStop(CalculationMode.Ticks, 26);

            SetProfitTarget("Short 1a", CalculationMode.Ticks, 16);
            SetTrailStop(CalculationMode.Ticks, 16);

            SetProfitTarget("Short 2a", CalculationMode.Ticks, 26);
            SetTrailStop(CalculationMode.Ticks, 16);

            SetProfitTarget("Short 3a", CalculationMode.Ticks, 80);
            SetTrailStop(CalculationMode.Ticks, 16);
            }

            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
            if (Time[0].DayOfWeek != DayOfWeek.Monday && Time[0].DayOfWeek != DayOfWeek.Friday)
            {
            if ((ToTime(Time[0]) >= 83000 && ToTime(Time[0]) < 114500))
            {
            // Condition set 1
            if (CrossAbove(AaIchimokuNT7(20, 14, 9, 26, 52).KijunSen, AaIchimokuNT7(20, 14, 9, 26, 52).SenkouSpanA, 1)
            && AaIchimokuNT7(20, 14, 9, 26, 52).ChikouSpan[26] > High[26])
            {
            EnterLong("Long 1a");
            EnterLong("Long 2a");
            EnterLong("Long 3a");
            }

            // Condition set 2
            if (CrossBelow(Close, anaSuperTrendM11((int) (3.2), 3, 2, false).StopDot, 1))
            {
            ExitLong("Trail Break Stop ", "");
            }

            // Condition set 3
            if (CrossBelow(AaIchimokuNT7(20, 14, 9, 26, 52).KijunSen, AaIchimokuNT7(20, 14, 9, 26, 52).SenkouSpanA, 1)
            && AaIchimokuNT7(20, 14, 9, 26, 52).ChikouSpan[26] < Low[26])
            {
            EnterShort("Short 1a");
            EnterShort("Short 2a");
            EnterShort("Short 3a");
            }

            // Condition set 4
            if (CrossAbove(Close, anaSuperTrendM11((int) (3.2), 3, 2, false).StopDot, 1))
            {
            ExitShort("Trail Break Stop ", "");
            }

            }
            }
            }

            #region Properties
            [Description("")]
            [GridCategory("Parameters")]
            public int MyInput0
            {
            get { return myInput0; }
            set { myInput0 = Math.Max(1, value); }
            }
            #endregion
            }
            }

            Comment


              #7
              If you wanted to modify the stoploss after a specific profit target has been hit, you would need to monitor these orders in OnExecution and OnOrderStatus, which are more advanced programming concepts.


              You should also be able to accomplish your goal by creating an ATM Strategy template and calling an ATM Strategy method. An example of doing so can be found below:



              You can see an example of how to use an ATM Strategy in Tools--> Edit NinjaScript--> Strategy--> SampleATMStrategy
              MatthewNinjaTrader Product Management

              Comment


                #8
                Moving My Stop Loss to Entry

                Thanks for the Help... But i still cant seen to get it.. I am trying to move my StopLoss from -16 at Entry,, to Break Even/Entry Price after My 1st Target has hit +12tic,,,

                Is there any video on ATM Strategy??
                Thank
                Marc

                Comment


                  #9
                  I'm including a Youtube link on ATM Strategies:

                  MatthewNinjaTrader Product Management

                  Comment


                    #10
                    Thank you.. i will watch and study..lol

                    Comment


                      #11
                      That video was just how to set up DOM.. I was looking on hoe to put ATM code into my Strategy..

                      I will keep looking..
                      Thanks

                      Comment


                        #12
                        I still need a little more Help..

                        This works real good,, But when i want my Car 3 to be a runner and close when it cross My ATR Trail Stop.. it will not Exit.. only close at end of day..

                        Thanks For any Help

                        Marc

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        628 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        359 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        105 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        562 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        568 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X