• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnPositionUpdate - MarketPosition parameter - what's it good for?

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

    #16
    Originally posted by sledge View Post
    But if it never fills, then order gets rejected....
    What never fills? I do not see your point, sorry. Maybe I am just dense?

    We are simply checking a position before we make an entry. I was replying to @pstrusi, (the immediate querier) so maybe we are talking at cross purposes?

    Comment


      #17
      Originally posted by pstrusi View Post
      Thanks Koganam, the problem is that you presume that I'm exiting when actually I'm reversing positions. I'm sorry NOT to clear that before
      It does not matter. You make your query of the position immediately before you make your order. Reversing is still just "making an entry in the opposite direction". If using Unmanaged orders, it is placing a quantity higher than the current position: if using Managed orders and properly arranged, NT will take care of the exit and reversal orders.

      Regardless, just as you would do if you were manually clicking the mouse, you decide that you are going to make a kind of entry order, so you check your position, then make the necessary order. You check your position immediately before you make the order, no matter how many times you have checked the position, or not, in the past.

      It is very simple. Before you put your money it risk, the last thing that you do is check your position, so as to be sure that you are not making a mistake by entering the order that you are about to make. There is nothing to argue about. Whether the computer makes the entry or you click the mouse, the entry decision process is exactly the same

      Comment


        #18
        Koganam, I'm not trying to trade as HFT with my algo, still some signals might trigger within a timeframe where actually an old order was just submit, still working...etc So before the new order is submit, in order to avoid overfillings or unwilling positions, I HAVE to check what is my instance position, I don't think that this simple request is something complicated to NT, or at least it shouldn't be.

        Thanks for your willing to help always

        Comment


          #19
          Originally posted by pstrusi View Post
          Koganam, I'm not trying to trade as HFT with my algo, still some signals might trigger within a timeframe where actually an old order was just submit, still working...etc So before the new order is submit, in order to avoid overfillings or unwilling positions, I HAVE to check what is my instance position, I don't think that this simple request is something complicated to NT, or at least it shouldn't be.

          Thanks for your willing to help always
          How does that negate anything that I have said? I specifically said that you are just asking the computer to do exactly what you would do manually, and exactly what you have described anyway. What has HFT got to do with the matter?

          Well, if you will not take the simple solution, I guess I will leave to to find the complicated solution that you are seeking. Yes, it is a simple request, and no, it is not complicated. You are the one who wants to make it complicated. You have been given a simple, reliable solution that I use myself personally, and you persist in looking for some other answer.

          All the best to you. I am out.

          Comment


            #20
            I just want to do what you say: check my position before send a new order. I know how to do that, it could be done in OnBarUpdate, OnPositionUpdate...etc The reason for my request is because there's a doubt coming from OnPositionUpdate indicated by Sledge and still confirmed by NT support team here, that 's a difference depending in how you call it. So that's what I want to address. Let's wait for NT support team answer to contrast. Thanks

            Comment


              #21
              Hello pstrusi,

              Thank you for your response.

              Why not just use OnPositionUpdate() when position returns Flat? I may not be understanding your reason for avoiding this?

              The "actual" position or more accurately the position reported by the brokerage technology is marketPosition. The order of events as they are processed would be called through position.MarketPosition instead.
              Patrick H.NinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_PatrickH View Post
                Hello pstrusi,

                Thank you for your response.

                Why not just use OnPositionUpdate() when position returns Flat? I may not be understanding your reason for avoiding this?

                The "actual" position or more accurately the position reported by the brokerage technology is marketPosition. The order of events as they are processed would be called through position.MarketPosition instead.
                Hi Patrick

                So, having in mind what you say, then This following snippet would do the job?

                Code:
                protected override void OnPositionUpdate(IPosition position)
                		{
                			if ( position.MarketPosition == MarketPosition.Long )
                			{
                				cp=1.0;
                				
                			}
                			if ( position.MarketPosition == MarketPosition.Short )
                			{
                				cp=-1.0;
                				
                			}
                		}
                
                // Then before submitting any new order, would it good enough to check the value of CP, right?

                Comment


                  #23
                  If the variable cp is to be compared for the position of the strategy, yes. Keep in mind this would be as each update to position calls OnPositionUpdate(). So in sequence of the events.
                  Patrick H.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by sawtooth500, Today, 12:59 PM
                  1 response
                  3 views
                  0 likes
                  Last Post NinjaTrader_Spencer  
                  Started by Steve L, Yesterday, 09:36 PM
                  1 response
                  19 views
                  0 likes
                  Last Post NinjaTrader_Kate  
                  Started by MichaelAlexander, 04-25-2017, 03:28 AM
                  9 responses
                  1,170 views
                  0 likes
                  Last Post dani neira  
                  Started by uday12, Today, 11:34 AM
                  2 responses
                  9 views
                  0 likes
                  Last Post uday12
                  by uday12
                   
                  Started by Rober182, Today, 10:40 AM
                  3 responses
                  14 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Working...
                  X