Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

simple strategy

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

    simple strategy

    Good morning, like to me a very simple strategy, I just want to open me to a particular 8.00am for example a purchase price 5 ticks with a stop loss and take profit time, they could give me some idea?

    Thanks and regards.

    #2
    Hello,
    Thank you for your post.
    Can you clarify a little further on what you are looking for with your strategy?
    I look forward to your reply.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Mainly it is just that. I want to open a buy limit to 5 or 10 ticks above where the price and at a specific time, ie at 8am, 8:30 a.m., etc ...

      Thanks.

      Comment


        #4
        Hello,
        You could create a check using the ToTime() method to compare when the Time of the Current Bar is equal to 8:00AM. Within that check you would create an action to submit the order. You would not be able to submit a buy limit order above the market price however you could submit a stop order above the market price.
        I have provided an example of how you could do this below:

        Code:
        protected override void OnBarUpdate()
        {
            if(ToTime(Time[0]) == ToTime(8, 0, 0))
        		EnterLongStop(Close[0] + 5 * TickSize);
        }
        I would recommend to review the following links as well:

        Please let us know if you have any further questions.
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          Ok thank you very much, give me only needed to choose when I want, ie 8:30 a.m., 8:44 a.m., 9:02 a.m., etc, also you can also choose it to 5 ticks price, 6, 7 or 10 ticks, etc., above the price.

          Thanks again.
          Last edited by punkiy2111; 06-19-2016, 03:30 PM.

          Comment


            #6
            Excuse me, you could tell me how to do to put any hour, ie 8h, 8.33h, etc. And also ticks the distance in which I want to rise above the price? I want to change the parameters of the strategy at the time and distance I choose.

            Thank you.





            Originally posted by punkiy2111 View Post
            Ok thank you very much, give me only needed to choose when I want, ie 8:30 a.m., 8:44 a.m., 9:02 a.m., etc, also you can also choose it to 5 ticks price, 6, 7 or 10 ticks, etc., above the price.

            Thanks again.

            Comment


              #7
              Hello,
              The ToTime(8, 0 , 0) portion of the example is where you would enter the time. This translates to 8:00:00AM. If you wanted to do 8:33AM you would use ToTime(8, 0, 0).

              The portion of the example that shows how you can do 5 ticks above the closing price is within the order entry method Close[0] + 5 * TickSize. If you wanted to do 6 ticks above you would do Close[0] + 6 * TickSeze.

              If you have any further questions please let us know.
              Cody B.NinjaTrader Customer Service

              Comment


                #8
                Hello again, I managed to make it work me but I will not open orders at the exact time and execute commands before, if for example I want to open my order at 22:45:15 as it should place the code?

                Thanks again.

                Comment


                  #9
                  Hello,
                  I have provided an example below of how you could submit a long market order at 22:45:15.

                  protected override void OnBarUpdate()
                  {
                  if(ToTime(Time[0]) == ToTime(22, 45, 15)
                  EnterLong();
                  }

                  If we can be of any other assistance please let us know.
                  Cody B.NinjaTrader Customer Service

                  Comment


                    #10
                    Ok, and if what I want is to change the time from the parameters to change the time in a more comfortable way? as it should be done? I send you a screenshot. Thanks and regards.




                    QUOTE=NinjaTrader_CodyB;464352]Hello,
                    The ToTime(8, 0 , 0) portion of the example is where you would enter the time. This translates to 8:00:00AM. If you wanted to do 8:33AM you would use ToTime(8, 0, 0).

                    The portion of the example that shows how you can do 5 ticks above the closing price is within the order entry method Close[0] + 5 * TickSize. If you wanted to do 6 ticks above you would do Close[0] + 6 * TickSeze.

                    If you have any further questions please let us know.[/QUOTE]
                    Attached Files

                    Comment


                      #11
                      Hello,
                      You can achieve what you are seeing in that screenshot by using a public TimeSpan variable. I have provided an example below of how you could use TimeSpan.


                      Code:
                      protected override void Initialize()
                      {
                               MyTimeSpan = new TimeSpan(8, 0, 0);
                               CalculateOnBarClose = true;
                      }
                      
                      protected override void OnBarUpdate()
                      {
                               if(Time[0].TimeOfDay == MyTimeSpan)
                               {
                                        Print(MyTimeSpan.ToString());
                               EnterLong();
                               }
                      }
                      
                               #region Properties         
                               [XmlIgnore()]
                               [Description("TimeSpan")]
                               [GridCategory("Parameters")]
                               public TimeSpan MyTimeSpan
                               {get; set;}
                               [Browsable(false)]
                               public string MyTimeSpanSerialize {
                               get { return MyTimeSpan.ToString(); }
                               set { MyTimeSpan = TimeSpan.Parse(value); }
                      }
                      For more information on TimeSpan please see the following link: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
                      Cody B.NinjaTrader Customer Service

                      Comment


                        #12
                        Ok thanks, but I think perhaps I have not explained well. It is the same as is in Spain or London, what I mean is to manipulate time through the parameters of the strategy. I want to put an hour without having to edit the strategy in the same way that I can easily touch the stop loss or take profit.

                        Thank you.

                        Comment


                          #13
                          Hello,
                          The example that I provided will allow you to set the time from the strategy parameters.
                          Cody B.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_CodyB View Post
                            Hello,
                            The example that I provided will allow you to set the time from the strategy parameters.
                            Hello again. The code that you passed me to write the date on the parameters gives an error. Tell me something please.
                            Greetings.

                            Comment


                              #15
                              Hello,
                              I have attached the working strategy for the example I have provided. Please let me know if you receive any errors with this example. If you do I will need you to specify the errors you receive.
                              Attached Files
                              Cody B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Haiasi, 04-25-2024, 06:53 PM
                              2 responses
                              17 views
                              0 likes
                              Last Post Massinisa  
                              Started by Creamers, Today, 05:32 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post Creamers  
                              Started by Segwin, 05-07-2018, 02:15 PM
                              12 responses
                              1,786 views
                              0 likes
                              Last Post Leafcutter  
                              Started by poplagelu, Today, 05:00 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post poplagelu  
                              Started by fx.practic, 10-15-2013, 12:53 AM
                              5 responses
                              5,408 views
                              0 likes
                              Last Post Bidder
                              by Bidder
                               
                              Working...
                              X