Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

There seems to be two ways of doing order protection

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

    #16
    Originally posted by NinjaTrader_Josh View Post
    Only in very specific scenarios will Set methods prevent limit orders.

    "Methods that generate orders (excluding market orders) to enter a position will be ignored if:
    • A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction"
    Advanced order handling will allow you the flexibility you are looking for so yes.
    Hmm, here is my experience. If I have SetStopLoss() set in the initialize, or reset after testing if flat, then EnterLongLimit() orders are dead in the water as they they are not alive.

    I'm not sure that falls within what you are saying above.

    Anyway, I think the pain of trying not to use AOH is becoming greater than the pain of wrapping my brain around AOH.

    Thank you for all your help.


    Regards,

    Comment


      #17
      Josh,

      I'm in the early stages of AOH, but let me just say, that once you get your core pieces in place, the elegance is unprecendented. Still need to do homework, but the initial testing is very promising.

      It really allows you to monitor your trade completely from beginning to end. Very powerful. I feel like I am truly on my way to automating a lot of what I do manually now. (as it relates to the trade side).

      Also, did you see my last post about using Set Methods and EnterLongLimit and ExitLongLimit orders?

      Anyway, AOH is the play for me.


      Thanks,

      Comment


        #18
        r2kTrader,

        Would not know why you are experiencing that. Only if an internal order handling rule is violated will entries be prevented. You can use TraceOrders = true and look in the log tab to try and see what happened.
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          Originally posted by NinjaTrader_Josh View Post
          Only in very specific scenarios will Set methods prevent limit orders.

          "Methods that generate orders (excluding market orders) to enter a position will be ignored if:
          • A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction"
          Advanced order handling will allow you the flexibility you are looking for so yes.
          Josh,

          As I think about this, this may be the issue I am running into.

          Do I need to cancel all orders before doing an EnterLongLimit()? In other words, if I have SetStopLoss(200); or whatever in the Initialize(), no orders generate. I will look at my trace and logs, but I am just wondering what the "rules" are if I want to use limit orders with Set methods as I can't get them to jive :-(

          If I can do Limit orders, and use Set methods, it would be easier I think. Although I would still have to code a bool to track the signal and avoid my order being moved on each tick.

          I know I seem to be going in circles, but...

          Can I do the following.

          Use SetStopLoss() to manage all stops, each for unique trade
          AND
          Use EnterLongLimit() to enter trades long and also short obviously EnterShortLimit()
          Use SetProfitTarget() to exit trades.

          Would I simply do "if(
          Position.MarketPosition == MarketPosition.Flat
          ) or something like that to test if in trade or not and keep from new order being generated?

          As I revisit the Set methods, it seems it will do 90% of what I want with less code. The AOH is extremely enticing though, but I also can do that in my next version when more granular control becomes necessary.


          Thank you so much for all this help Josh.


          Regards,
          Last edited by r2kTrader; 06-29-2009, 06:01 PM.

          Comment


            #20
            SetStopLoss with Enter Limit orders

            Josh,

            I think I found the problem.

            I was putting in a SetStopLoss in Price mode, on the next line after my EnterLongLimit() and using Position.AvgPrice - (5 * TickSize) to calculate price, but then realized it one have an Average price yet because the order has not been realized yet and as such my price was .5 which will never be hit nor show up on my DOM.

            I think this was the issue.


            Thanks,

            Comment


              #21
              Originally posted by NinjaTrader_Josh View Post
              Right. Just keep in mind that Set() do not produce IOrder objects.
              Josh,

              I am now very confused.

              As per the help:
              The IOrder Class
              All order methods return an IOrder object. Several things you need to be aware of:



              It says ALL order methods return an IOrder object, but you say that Set methods do not produce IOrder objects.

              I want to track a StopLoss order that has been submitted by SetStopLoss and then once I confirm it has been excepted, I want to switch a bool to true.

              Can I use OnOrderUpdate or whatever if Set does not generate an IOrder object?

              Comment


                #22
                Final Decision - Advanced Order Handling

                Josh,

                Lol, I have gone full circle. I'm biting the bullet and going for AOH. It's the only way to really get what I want the right way. If you want to track what is happening keep things clean and under control, then AOH is the play.

                In the end, I am finding it easier than trying to manipulate the Set Methods to do what I want. I think the Set Methods have a place, but if you are going to trade real money, then you need to consider AOH as the ideal solution in my opinion.

                This is not to say you can't trade with the Set Methods, but for my specific model, it needs to be AOH.

                I'm just sorting through what code to put under which stage of the processing. The samples provide a great guide although a flow chart would be very helpful.

                Anyway, thanks for this thread. I would still like to get clarification on the Set Methods and IOrder objects, but it's not a priority.

                UPDATE:
                I just found this link
                http://linkzuki.com/0l

                This is what I was looking to do, but thought it coudl only be done with AOH. This is all part of the process I suppose. At least I will walk away with a strong understanding of order management from a programmatic perspective

                Thanks,
                Last edited by r2kTrader; 06-29-2009, 07:51 PM.

                Comment


                  #23
                  Order methods are Enter() and Exit()s, not Set()s. You can trap Set() orders in OnOrderUpdate() by checking order.Name for "Stop loss" or "Profit target", but the Set() itself does not return an IOrder.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by NinjaTrader_Josh View Post
                    Order methods are Enter() and Exit()s, not Set()s. You can trap Set() orders in OnOrderUpdate() by checking order.Name for "Stop loss" or "Profit target", but the Set() itself does not return an IOrder.
                    As per that link I referenced in last post, I understand what you are saying by "name". Got it.

                    With all that being said, and if I am going to essentially do an OnOrderUpdate() check, would it essentially be the same thing as using AOH anyway?

                    What do I get with Set Methods, that really make them so much easier? I guess as long as I can see if an order is working or not, I can stop the resubmitting of my orders on each bar update, which was my primary reason for exploring AOH to begin with. But I will still need to manage an IOrder object for the signal to enter as well anyway, lol.

                    I am going to read your other posts about Set Methods further. It's getting clearer and clearer as I continue my homework.

                    Thanks,

                    Comment


                      #25
                      r2kTrader,

                      If you are going to use OnOrderUpdate()/OnExecution() I suggest you just stick with Enter() and Exit()s so you actually have IOrder objects you can reference.

                      Set() don't give you an object for referencing prices, fill amounts, etc.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #26
                        Thanks Josh,

                        I think what is pushing me back is the "For Advanced Programmers Only" comment. I don't consider myself an Advanced Programmer. Is that really to mean anyone who is pretty much using the wizard to build a strategy and doesn't have a tech background?

                        Based on my posts, do you feel I have enough experience to use AOH without major problems? I think I might be over-thinking this.


                        Thanks,

                        Comment


                          #27
                          r2kTrader,

                          Unfortunately I cannot make that evaluation for you. I suggest you just give it a try in sim.
                          Josh P.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by muratb35, Today, 03:36 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post muratb35  
                          Started by fernlicht, Today, 02:16 AM
                          1 response
                          8 views
                          0 likes
                          Last Post NT-Roland  
                          Started by fernlicht, 04-12-2021, 06:01 PM
                          1 response
                          28 views
                          0 likes
                          Last Post NinjaTrader_PaulH  
                          Started by memonolog, Today, 02:10 AM
                          2 responses
                          4 views
                          0 likes
                          Last Post NT-Roland  
                          Started by orenytz, Today, 12:25 AM
                          0 responses
                          8 views
                          0 likes
                          Last Post orenytz
                          by orenytz
                           
                          Working...
                          X