Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder - valuetostring

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

    #16
    Hello,

    for having finally an idea about the sense of these posts I have to state.

    Patrick posted to do with

    if(myCondition) { stopOrder = ExitLongStop(0, true, 3000, execution.Order.AvgFillPrice -100 * TickSize, "StopML1a", "ML1"); } if(myOtherCondition) { stopOrder = ExitLongStop(0, true, 3000, myNewStopPrice, "StopML1a", "ML1"); }

    I changed my coding and posted that there occur the error messages in output window

    Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=1000 LimitPrice=0 StopPrice=1,3191'7 SignalName=StopD1b' FromEntrySignal='D1' Reason='There already is a matching order with same prices and quantity'
    and again
    and again....
    then I got the answer to use different signal names after I have changed from different signal names referring to reply of NT-support ("nstead of submitting multiple Stop Orders with different names, strings or IOrder. Just use one IOrder for all stops."

    In the last post here I find "Keeping the order price and signal name unique will work as well." but I mentioned before that when doing so there appear the error messages in the output window.

    Sorry, this is not correct.

    So, how to work with the one IOrder when there appear the message in output window as posted above?


    Best
    Tony

    and

    Comment


      #17
      Hi tonynt,

      Thanks for your reply.

      As an example, in your code you have 3 calls:
      stopOrder2a = ExitShortStop(0, true, 1000, Position.AvgPrice -(10*TickSize), "StopSTO2a", "STO1");
      stopOrder2b = ExitShortStop(0, true, 1000, Position.AvgPrice -(10*TickSize), "StopSTO2b", "STO1");
      stopOrder2c = ExitShortStop(0, true, 1000, Position.AvgPrice -(10*TickSize), "StopSTO2c", "STO1");

      The conditions for these calls do not exclude each other so in one OnBarUpdate call all 3 can be placed. The price amounts for these are all the same (Position.AvgPrice-(10*TickSize). You will not be able to place 3 orders at the same level in this manner as all three would trigger at the same time for the same entry signal.


      Please let me know if this does not resolve your inquiry.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Hello,

        thank you for your reply. Sorry, but I can not agree.

        I do in different strategies an entry with 3000 and I have 3 initial stops 1a,1b,1c. Once eg 80 pips in profit I move all 3 and rename to 2a, 2b, 2c, so I see immediately in orders-tab the situation.

        What should be the importance if all 3 have same price OR NOT? Why should I no be able to place 3 orders at the same level? And of course all 3 should trigger at the same time - if price is there. This is the sense of the stop(???)

        What you mean?

        PS: and I know very well it would be more easy to do with 3x1000 entries with different entry-name. But there are reasons for doin with 1 x 3000.

        The only question that remains is how to do in onexecution and onorderupdate with 2 conditions like

        if(exitOrder1a!=null&&exitOrder1a==execution.Order &&execution.Order.OrderState==OrderState.Filled )

        if(conditions1) then do
        else if (conditions2) then do

        There appear an error message in output window "...object not set to an instance...".

        Isn´t it possible to do the conditions with if and else if in oneExecution and onorderupdate or only to do for checking status?

        Thanks
        Tony

        Originally posted by NinjaTrader_ChelseaB View Post
        Hi tonynt,

        Thanks for your reply.

        As an example, in your code you have 3 calls:
        stopOrder2a = ExitShortStop(0, true, 1000, Position.AvgPrice -(10*TickSize), "StopSTO2a", "STO1");
        stopOrder2b = ExitShortStop(0, true, 1000, Position.AvgPrice -(10*TickSize), "StopSTO2b", "STO1");
        stopOrder2c = ExitShortStop(0, true, 1000, Position.AvgPrice -(10*TickSize), "StopSTO2c", "STO1");

        The conditions for these calls do not exclude each other so in one OnBarUpdate call all 3 can be placed. The price amounts for these are all the same (Position.AvgPrice-(10*TickSize). You will not be able to place 3 orders at the same level in this manner as all three would trigger at the same time for the same entry signal.


        Please let me know if this does not resolve your inquiry.

        Comment


          #19
          Hi Tony,

          Unless you make three separate entry signals and point your stop orders to those you will continue to experience this error using this code. Making three separate entry signals will correct this issue.

          For example:

          if (Position.MarketPosition == MarketPosition.Flat)
          {
          entryOrder1=EnterShort(1000, "STO1");
          entryOrder2=EnterShort(1000, "STO2");
          entryOrder3=EnterShort(1000, "STO3");
          }

          stopOrder2a = ExitShortStop(0, true, 1000, Position.AvgPrice -(10*TickSize), "StopSTO2a", "STO1");
          stopOrder2b = ExitShortStop(0, true, 1000, Position.AvgPrice -(10*TickSize), "StopSTO2b", "STO2");
          stopOrder2c = ExitShortStop(0, true, 1000, Position.AvgPrice -(10*TickSize), "StopSTO2c", "STO3");


          An alternative would be to use an ATM strategy if you would like to use one entry order.
          Included with NinjaTrader is the SampleATMStrategy that demonstrates how this is done.


          Please let me know if this does not resolve your inquiry.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by tonynt View Post
            Hello,

            thank you for your reply. Sorry, but I can not agree.

            I do in different strategies an entry with 3000 and I have 3 initial stops 1a,1b,1c. Once eg 80 pips in profit I move all 3 and rename to 2a, 2b, 2c, so I see immediately in orders-tab the situation.

            What should be the importance if all 3 have same price OR NOT? Why should I no be able to place 3 orders at the same level? And of course all 3 should trigger at the same time - if price is there. This is the sense of the stop(???)

            What you mean?

            PS: and I know very well it would be more easy to do with 3x1000 entries with different entry-name. But there are reasons for doin with 1 x 3000.

            The only question that remains is how to do in onexecution and onorderupdate with 2 conditions like

            if(exitOrder1a!=null&&exitOrder1a==execution.Order &&execution.Order.OrderState==OrderState.Filled )

            if(conditions1) then do
            else if (conditions2) then do

            There appear an error message in output window "...object not set to an instance...".

            Isn´t it possible to do the conditions with if and else if in oneExecution and onorderupdate or only to do for checking status?

            Thanks
            Tony
            See what I have highlighted in red? That is your real issue. Why do you have to rename the Stop orders?.

            I suggested to you multiple times that ll you need to do is reissue orders 1a, 1b and 1c, using the exact same orderNames and syntax, and only change the price. Whereas what I describe is not the only way to do it, it is much simpler than your convoluted method that you seem to insist on using where you are trying to handle all the minutiae of cancelling, renaming, giving new orders etc, etc, etc.

            It is especially surprising that you insist on doing it your way, given that by simply reissuing the orders as described, NT will take care of all the mechanics for you.

            Comment


              #21
              koganam,

              thank you for your reply, and all you other replies. A forum improves with people like you!

              I got the idea to solve my problem "my way" with getting the head clear when cutting the meadow and working in the garden again few hours

              I want to inform you why I "insist" in doing so. The order handling is better when I have different names. What do you do if an order is rejected? How can you tell NT which contract to exit, to cancel? Which corresponding stops to close? And what in case of overfill? I can handle all of this better when I use different names - for stops and targets.

              PS: I´m just wondering about some replies of NT-Support eg with using the same name - you know that there comes the error-message to see in the output window because with same name for stoporder:

              Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=1000 LimitPrice=0 StopPrice=1,3191'7 SignalName=StopD1b' FromEntrySignal='D1' Reason='There already is a matching order with same prices and quantity'" again and again..... because condition is true. This you can use only with adding a bool or variable to count, no? I could do it, but finding the answer with bool and variable on my own. But this was not in the answer!

              Therefore I asked you how would you do it with same name because with eg

              if(GetCurrentBid() <= Position.AvgPrice - (40*TickSize))
              stopOrder (= same name1) = ExitShortStop(0, true, 1000, newprice, "xxyy, "XY");

              there appears "ignored......" as error-message. No?

              Thank you again for your replies.

              Best regards
              Tony




              Originally posted by koganam View Post
              See what I have highlighted in red? That is your real issue. Why do you have to rename the Stop orders?.

              I suggested to you multiple times that ll you need to do is reissue orders 1a, 1b and 1c, using the exact same orderNames and syntax, and only change the price. Whereas what I describe is not the only way to do it, it is much simpler than your convoluted method that you seem to insist on using where you are trying to handle all the minutiae of cancelling, renaming, giving new orders etc, etc, etc.

              It is especially surprising that you insist on doing it your way, given that by simply reissuing the orders as described, NT will take care of all the mechanics for you.

              Comment


                #22
                Originally posted by tonynt View Post
                koganam,

                thank you for your reply, and all you other replies. A forum improves with people like you!

                I got the idea to solve my problem "my way" with getting the head clear when cutting the meadow and working in the garden again few hours

                I want to inform you why I "insist" in doing so. The order handling is better when I have different names. What do you do if an order is rejected? How can you tell NT which contract to exit, to cancel? Which corresponding stops to close? And what in case of overfill? I can handle all of this better when I use different names - for stops and targets.

                PS: I´m just wondering about some replies of NT-Support eg with using the same name - you know that there comes the error-message to see in the output window because with same name for stoporder:

                Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=1000 LimitPrice=0 StopPrice=1,3191'7 SignalName=StopD1b' FromEntrySignal='D1' Reason='There already is a matching order with same prices and quantity'" again and again..... because condition is true. This you can use only with adding a bool or variable to count, no? I could do it, but finding the answer with bool and variable on my own. But this was not in the answer!

                Therefore I asked you how would you do it with same name because with eg

                if(GetCurrentBid() <= Position.AvgPrice - (40*TickSize))
                stopOrder (= same name1) = ExitShortStop(0, true, 1000, newprice, "xxyy, "XY");

                there appears "ignored......" as error-message. No?

                Thank you again for your replies.

                Best regards
                Tony
                Again, the stuff in red.

                I think that you are confusing the issue. Your targets and stops must necessarily have different names if you choose to name them.

                Here is the point. if your initial stop is named for example Stop1a, why does it need to be renamed when you move it? No matter what it is named, if it is rejected, it will be rejected with that name. Therefore, once the name is declared, there is never a need to rename it. A name is a name, is a name. That is what I mean when I say that you are concerning yourself needlessly with minutiae that is best left to the NT engine to handle. The problem that you think you are trying to solve does not exist.

                The error about price and name that you are getting is telling you exactly what is wrong with what you are trying to do. You cannot reissue an order, with a given name, at the same price. If you are changing the price, then change the price: issuing the order at the same price means that you are not changing the price.

                One thing in programming: one should NEVER perform any action that is not absolutely necessary. Your order will be identified by whatever it is NAMED, at the time that whatever happens to it happens to it, so there is no need to rename it.

                Let me tackle it differently.
                1. Give me your exact code for entering the position. (Not the logic, just the entry order, given the entry conditions in pseudocode).
                2. Give me the exact code for what condition must be met to move the stop.

                Here is an example:
                if (longCondition) //write this exactly this way. It represents your long entry condition, whose code logic I do not want you to expose.
                {
                //in here put the EXACT code that you have that you use to enter the order
                }

                if (needToMoveStop) //write this exactly this way
                {
                //in here put the EXACT code that you have that you use to enter the modified order
                }
                Last edited by koganam; 08-29-2014, 09:59 AM. Reason: Corrected spelling.

                Comment


                  #23
                  koganam,

                  again, thank youi so much for your reply! I appreciate if someone wants to help another one as you do. This is great!

                  I think you are right from your point of view. Let me shortly explain what I do and why I think for me are better having different names: in my understanding I can not cancel eg stopOrder1a in certain conditions because then I have no stop anymore. With different stops a.) for different contracts of a trade I can grab them as I need (I do an entry with eg 3000 but then for order handling I seperate to 3 x 1000 (This is the first reason why I can not use Setstoploss).
                  b.) when an order is rejected I dont want to shut down the strategy, only the contract in concern with its targets and stops in concern should be cancelled/exited/closed
                  c.) moreover I have made my customized buttons where I change the stops depending from situation from "automatic-strategy-stops" to "manuall-discretionary-stops" - depending from pivots or instrumens (eg USDNOK has other spread)
                  d.) I can switch back from manual stops to autostops depending from price action and then I need to cancel my stopOrderm1a, stopOrderm1b, stopOrderm1c because I have now again stopOrder1a....
                  e.) I have buttons for scaling out - also here the corresponding stops need to be handled.

                  With my stopOrder1a (first contract, autostop) and stopOrderm1a (first contract, manual changed stop), stopOrderm2a (2nd change of manual stop order...) I can handle all and I can see immediately in the executions and orders tab where I am.

                  Maybe I could explain my humble opinion.

                  But let me add this (again). Why do you say that with different names I get the error message "Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=1000 LimitPrice=0 StopPrice=1,3191'7 SignalName=StopD1b' FromEntrySignal='D1' Reason='There already is a matching order with same prices and quantity'"???

                  I get this error message when working with one ordername - isnt this logical eg when if(Bid < 80Ticksize) then stopOrder1=exitshortstop(....). As long a price is 80 Tick below Average Price NT wants to change with every tick. With my solution I cancel the stopOrder1 and so the condition "accepted" is not true anymore. With one ordername then NT wants to change the stop with every tick and shows the error message above. Concerning this I asked you how this works when you do this way. The error message doesnt occur with my different ordernames!

                  Have a great day!

                  Best regards
                  Tony
                  Last edited by tonynt; 05-12-2013, 04:58 AM. Reason: clearify

                  Comment


                    #24
                    Originally posted by tonynt View Post
                    koganam,

                    again, thank youi so much for your reply! I appreciate if someone wants to help another one as you do. This is great!

                    I think you are right from your point of view. Let me shortly explain what I do and why I think for me are better having different names: in my understanding I can not cancel eg stopOrder1a in certain conditions because then I have no stop anymore. With different stops a.) for different contracts of a trade I can grab them as I need (I do an entry with eg 3000 but then for order handling I seperate to 3 x 1000 (This is the first reason why I can not use Setstoploss).
                    b.) when an order is rejected I dont want to shut down the strategy, only the contract in concern with its targets and stops in concern should be cancelled/exited/closed
                    c.) moreover I have made my customized buttons where I change the stops depending from situation from "automatic-strategy-stops" to "manuall-discretionary-stops" - depending from pivots or instrumens (eg USDNOK has other spread)
                    d.) I can switch back from manual stops to autostops depending from price action and then I need to cancel my stopOrderm1a, stopOrderm1b, stopOrderm1c because I have now again stopOrder1a....
                    e.) I have buttons for scaling out - also here the corresponding stops need to be handled.

                    With my stopOrder1a (first contract, autostop) and stopOrderm1a (first contract, manual changed stop), stopOrderm2a (2nd change of manual stop order...) I can handle all and I can see immediately in the executions and orders tab where I am.

                    Maybe I could explain my humble opinion.

                    But let me add this (again). Why do you say that with different names I get the error message "Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=1000 LimitPrice=0 StopPrice=1,3191'7 SignalName=StopD1b' FromEntrySignal='D1' Reason='There already is a matching order with same prices and quantity'"???

                    I get this error message when working with one ordername - isnt this logical eg when if(Bid < 80Ticksize) then stopOrder1=exitshortstop(....). As long a price is 80 Tick below Average Price NT wants to change with every tick. With my solution I cancel the stopOrder1 and so the condition "accepted" is not true anymore. With one ordername then NT wants to change the stop with every tick and shows the error message above. Concerning this I asked you how this works when you do this way. The error message doesnt occur with my different ordernames!

                    Have a great day!

                    Best regards
                    Tony
                    I see. If you are manually intervening to try to manage entries that were made by a Strategy, then I suppose you do have to handle all the minutiae. I just wish that you had made that clear from the beginning.

                    I understand why you might want to do that, but while that might seem to provide more control, it seems to me that it loses the advantage of having an emotionless, stupid, GIGO, computer handle its trading. I have jumped out of too many trades that the computer would have held to a profit. Now I just let the computer manage that which it enters, and I manage only my manually entered orders.

                    All the best.

                    Comment


                      #25
                      koganam,

                      referring to my question how do you manage so that with one ordername there doesn´t occur the message""Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=1000 LimitPrice=0 StopPrice=1,3191'7 SignalName=StopD1b' FromEntrySignal='D1' *Reason='There already is a matching order with same prices and quantity'"?

                      This doesn´t occur with different ordernames, as the old can be cancelled. This occurs with one ordername with every tick.

                      Best
                      Tony


                      Originally posted by koganam View Post
                      I see. If you are manually intervening to try to manage entries that were made by a Strategy, then I suppose you do have to handle all the minutiae. I just wish that you had made that clear from the beginning.

                      I understand why you might want to do that, but while that might seem to provide more control, it seems to me that it loses the advantage of having an emotionless, stupid, GIGO, computer handle its trading. I have jumped out of too many trades that the computer would have held to a profit. Now I just let the computer manage that which it enters, and I manage only my manually entered orders.

                      All the best.

                      Comment


                        #26
                        Originally posted by tonynt View Post
                        koganam,

                        referring to my question how do you manage so that with one ordername there doesn´t occur the message""Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=1000 LimitPrice=0 StopPrice=1,3191'7 SignalName=StopD1b' FromEntrySignal='D1' *Reason='There already is a matching order with same prices and quantity'"?

                        This doesn´t occur with different ordernames, as the old can be cancelled. This occurs with one ordername with every tick.

                        Best
                        Tony
                        Unfortunately, in order to understand that, I will have to get into the minutiae with you, and try to duplicate what you are trying to do.

                        As, in principle, I would not intervene to manually actively manage a position that was initiated by a strategy, that is not something that I will be able to do right now. As I said, I let my strategy manage its trades: I manage my trades that I enter manually. You prefer to manually take control of a Strategy trade, so I cannot really help you there.

                        Comment


                          #27
                          koganam,

                          we have some misunderstandings I assume.

                          Over all the question was simply how to change the stoploss (and not which order-handling makes sense - as sense depends from reason or objective. The discussion developed more in what makes sense or not). I show in an example what I mean:

                          if (entry condition)

                          on Execution
                          stopOrder1 = ExitLongStop(0, true, 1000, execution.Order.AvgFillPrice -100 * TickSize, "StopD1", "D1");

                          onBarUpdate
                          if(GetCurrentBid() > Position.AvgPrice + (80*TickSize)
                          && stopOrder1!= null && stopOrder1.OrderState==OrderState.Accepted)
                          {stopOrder1 = ExitLongStop(0, true, 1000, Position.AvgPrice, "StopD1", "D1");}

                          But there appear the message in the output window:
                          10.05.2013 12:50:14 Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=1000 LimitPrice=0 StopPrice=1,3191'7 SignalName=StopD1' FromEntrySignal='D1' Reason='There already is a matching order with same prices and quantity'

                          I assume NT wants to make a new stopOrder1 with every incoming tick as long as Bid > Avg.Price +80*Ticksize.

                          How one can avoid this? (without bool or double)

                          Best
                          Tony

                          Originally posted by koganam View Post
                          Unfortunately, in order to understand that, I will have to get into the minutiae with you, and try to duplicate what you are trying to do.

                          As, in principle, I would not intervene to manually actively manage a position that was initiated by a strategy, that is not something that I will be able to do right now. As I said, I let my strategy manage its trades: I manage my trades that I enter manually. You prefer to manually take control of a Strategy trade, so I cannot really help you there.

                          Comment


                            #28
                            Originally posted by tonynt View Post
                            koganam,

                            we have some misunderstandings I assume.

                            Over all the question was simply how to change the stoploss (and not which order-handling makes sense - as sense depends from reason or objective. The discussion developed more in what makes sense or not). I show in an example what I mean:

                            if (entry condition)

                            on Execution
                            stopOrder1 = ExitLongStop(0, true, 1000, execution.Order.AvgFillPrice -100 * TickSize, "StopD1", "D1");

                            onBarUpdate
                            if(GetCurrentBid() > Position.AvgPrice + (80*TickSize)
                            && stopOrder1!= null && stopOrder1.OrderState==OrderState.Accepted && stopOrder1.
                            StopPrice != Position.AvgPrice)
                            {stopOrder1 = ExitLongStop(0, true, 1000, Position.AvgPrice, "StopD1", "D1");}

                            But there appear the message in the output window:
                            10.05.2013 12:50:14 Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=1000 LimitPrice=0 StopPrice=1,3191'7 SignalName=StopD1' FromEntrySignal='D1' Reason='There already is a matching order with same prices and quantity'

                            I assume NT wants to make a new stopOrder1 with every incoming tick as long as Bid > Avg.Price +80*Ticksize.

                            How one can avoid this? (without bool or double)

                            Best
                            Tony
                            Now that you have provided what I asked you to provide 3 posts ago, I can see what you have coded, and I can tell you that if you do not want to process a statement unless something has changed, you just need to gate the expression with an equality statement. I have added it in red, to your code.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by argusthome, 03-08-2026, 10:06 AM
                            0 responses
                            111 views
                            0 likes
                            Last Post argusthome  
                            Started by NabilKhattabi, 03-06-2026, 11:18 AM
                            0 responses
                            59 views
                            0 likes
                            Last Post NabilKhattabi  
                            Started by Deep42, 03-06-2026, 12:28 AM
                            0 responses
                            38 views
                            0 likes
                            Last Post Deep42
                            by Deep42
                             
                            Started by TheRealMorford, 03-05-2026, 06:15 PM
                            0 responses
                            42 views
                            0 likes
                            Last Post TheRealMorford  
                            Started by Mindset, 02-28-2026, 06:16 AM
                            0 responses
                            78 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Working...
                            X