Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

*NT** AtmStrategyChangeStopTarget() method error: OrderName 'STOP1' does not exist

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

    #16
    You allready got that code i post it here. that atm code block.
    Post number five. you can also use now just one message before. code. use fx use replay use tenth pips.


    Because that also not work what i just created in 5 mins.
    It have to be somewhere settings or options !!!!! Please tell me where I can find such options which can affect.

    Comment


      #17
      There is two targets
      1target 2 target
      -----------------------------
      stops 90 90
      target1 70 target2 350



      Break even 70 , 10 pips

      and trailings


      and two stop strategy

      Comment


        #18
        use also output window you senn error messages

        Comment


          #19
          Hello,

          This code works for me.

          Do you ge the error on just Stop 2? Or both Stop 1 and Stop 2?

          Also,

          I dont know if this is tjust this code you created but your missing many things.

          Such as I cant see where or how you set aboo back to false. So that this code doesnt continue to run even if there isnt another strategy running.

          Comment


            #20
            Both,

            Use two targets, stop 90 , targets 90 and 250,
            check output window.

            aboo is set by crateatmstrategy method. dont think abooo its really don,t matter removed or whatever, its just example, and its just have to run once, and output window shows error.


            #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 MyCustomStrategy : 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()
            {

            CalculateOnBarClose = true;
            }

            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
            // Condition set 1
            if (CrossAbove(Close, SMA(14), 1) == true)
            {
            int SuperRule=1;

            if(SuperRule==1)
            {
            string atmid=GetAtmStrategyUniqueId();
            string orderId = GetAtmStrategyUniqueId();



            bool aboo=AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0,Cbi.TimeInForce.Gtc
            , orderId, "EURO3",atmid);

            // bool aboo=AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0,Cbi.TimeInForce.Gtc
            //, orderId, "EURO3",atmid);

            if (aboo==true)
            {
            // jfBuy();
            // DrawText("bl"+CurrentBar,"BUY \n at Market \n "+GetCurrentAsk(), 0,L-40*TickSize, Color.DarkGreen);
            // DrawArrowUp("MyArrowDown"+CurrentBar,false, 0,Low[0];-30*TickSize, Color.Green);
            int positionstate=1;
            }

            // Modifying stops if calculated stop better than Constant ATM stop.
            double stoplong=Close[0]-0.00010;

            AtmStrategyChangeStopTarget(0, stoplong, @"STOP1", atmid);
            AtmStrategyChangeStopTarget(0, stoplong, @"STOP2", atmid);
            //AtmStrategyChangeStopTarget(0, Low[0] - 3 * TickSize, "STOP1", atmStrategyId);
            Print("STOP CHANGED LOWER VALUE: "+stoplong.ToString());



            }





            }
            }

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

            Comment


              #21
              Its not use aboo for anything, dont think it.

              Comment


                #22
                Here is version where is no aboo and you don't have to think aboo
                two targets, stops 90 and targets 80 and 250.

                **NT** AtmStrategyChangeStopTarget() method error: OrderName 'STOP1' does not exist
                **NT** AtmStrategyChangeStopTarget() method error: OrderName 'STOP2' does not exist


                protected override void OnBarUpdate()
                {
                // Condition set 1
                if (CrossAbove(Close, SMA(14), 1) == true)
                {

                string atmid=GetAtmStrategyUniqueId();
                string orderId = GetAtmStrategyUniqueId();


                AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0,Cbi.TimeInForce.Gtc
                , orderId, "EURO3",atmid);

                double stoplong=Close[0]-0.00010;
                AtmStrategyChangeStopTarget(0, stoplong, @"STOP1", atmid);
                AtmStrategyChangeStopTarget(0, stoplong, @"STOP2", atmid);


                }




                }

                Comment


                  #23
                  So ????? where I can start looking.
                  My ninja version is 7.1000.2

                  Comment


                    #24
                    I am not sure do you know how to look fxpro, there should be 10 pip stop, and no error messages in output window.
                    use $eurusd.

                    Comment


                      #25
                      and also that you donät ask next client, if that strategy is not created, and you try to access or set new stops, it will give different error message.

                      Comment


                        #26
                        Hello,

                        I ran your code test again on EUR/USD with no issues.

                        Can you please try running the SampleATMStrategy that is installed in NinjaTrader by default, then create and ATM Strategy for the AtmStrategyTemplate, Dont re use your old ATM Strategy Template I want you to create a new one for this test.

                        Does this work?

                        Comment


                          #27
                          I think sample is using market price,its looks its works, its placing pending order.

                          my strategyis running calcbar=false and uses first tickof bar.

                          But still not understand why second example what i sent to you was working in your machine and not mine.

                          I try to test more. get back soon

                          Comment


                            #28
                            have you tested all the time, ninja atm example, or my example.

                            Should this stop setting wait in loop when stratetegy order is filled, before it can set new stops.

                            Comment


                              #29
                              Brett will be taking a look shortly at your reply and let you know what he was testing on his end.

                              Thanks for your patience.
                              BertrandNinjaTrader Customer Service

                              Comment


                                #30
                                Ok, thanks,
                                I just was testing and thinking, that if i create atmstrategy i maybe not can't set stop values just right after create function and strategy have to wait, because after creating atm strategy its not filled and there is no stop values ????

                                if you check my example code, its setting immediatly stops after creating atm strategy

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by 00nevest, Today, 02:27 PM
                                0 responses
                                0 views
                                0 likes
                                Last Post 00nevest  
                                Started by Jonafare, 12-06-2012, 03:48 PM
                                5 responses
                                3,986 views
                                0 likes
                                Last Post rene69851  
                                Started by Fitspressorest, Today, 01:38 PM
                                0 responses
                                2 views
                                0 likes
                                Last Post Fitspressorest  
                                Started by Jonker, Today, 01:19 PM
                                0 responses
                                2 views
                                0 likes
                                Last Post Jonker
                                by Jonker
                                 
                                Started by futtrader, Today, 01:16 PM
                                0 responses
                                9 views
                                0 likes
                                Last Post futtrader  
                                Working...
                                X