Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder - valuetostring

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

    IOrder - valuetostring

    Hello,

    in my strategies I do change value-to-string (this just for information that I know about this how to do) and I want to ask please if it´s possible in the syntax eg

    stopOrder3 substitute like stopOrder"value.ToString()"

    because I want to handle and count my stopOrders with "value++;" each time changed because I need to cancel the stop before once a new stop is in.

    (eg when I move the stop with Donchian, so if there is a new value of Donchian I want to bring in a new stop and cancel the stop before of course. Each stop needs a proper name=value)

    Thanks
    Tony
    Last edited by tonynt; 05-05-2013, 07:15 AM. Reason: clearify

    #2
    Originally posted by tonynt View Post
    Hello,

    in my strategies I do change value-to-string (this just for information that I know about this how to do) and I want to ask please if it´s possible in the syntax eg

    stopOrder3 substitute like stopOrder"value.ToString()"

    because I want to handle and count my stopOrders with "value++;" each time changed because I need to cancel the stop before once a new stop is in.

    (eg when I move the stop with Donchian, so if there is a new value of Donchian I want to bring in a new stop and cancel the stop before of course. Each stop needs a proper name=value)

    Thanks
    Tony
    If you want to change a Stop, just reissue the same order with new values: there is no need for what you describe.

    Comment


      #3
      koganam,

      thank you for your reply. How would you do to reissue the same order with new values when you can not change the stop (because of reasons at the broker)? I have to bring in a new stop and cancel the old stop(?)

      I´m happy if you tell me how to do better. How do you cancel when you reissue the same order with new values as you mention?

      Thanks
      Tony

      Originally posted by koganam View Post
      If you want to change a Stop, just reissue the same order with new values: there is no need for what you describe.

      Comment


        #4
        Originally posted by tonynt View Post
        koganam,

        thank you for your reply. How would you do to reissue the same order with new values when you can not change the stop (because of reasons at the broker)? I have to bring in a new stop and cancel the old stop(?)

        I´m happy if you tell me how to do better. How do you cancel when you reissue the same order with new values as you mention?

        Thanks
        Tony
        The point of having an API framework is many times to help avoid dealing with minutiae that are details which detract from the larger purpose. The NT order management API takes care of cancelling and issuing amended orders, precisely so that you do not have to. Which broker are you using that will not allow you to change a Stop?

        In any case, you reissue the order in the same manner that you issued the original order.

        if (WantToChangeStop)
        {
        stopOrder = ExitOrder(amendedParameters ...);
        }

        where stopOrder is your original IOrder, and ExitOrder is the same type of order that you orignally issued.

        Comment


          #5
          koganam,

          thank you for your reply!

          The broker is Dukascopy and is not supported by NT.

          Very sorry, I don´t understand how you mean. I do eg:

          if (stopOrder2a != null && stopOrder2a == order)
          {
          if (order.OrderState == OrderState.Accepted)
          CancelOrder(stopOrder1a); stopstep = 2;

          else if (order.OrderState == OrderState.Rejected)
          {
          exitOrder1a = ExitShort(1000, "x1a","T1");
          CancelOrder(stopOrder1a);
          CancelOrder(stopOrder2a);
          }
          }

          How would you do for submitting new stop "2a" and cancelling the stop "1a"?

          Thanks
          Tony



          Originally posted by koganam View Post
          The point of having an API framework is many times to help avoid dealing with minutiae that are details which detract from the larger purpose. The NT order management API takes care of cancelling and issuing amended orders, precisely so that you do not have to. Which broker are you using that will not allow you to change a Stop?

          In any case, you reissue the order in the same manner that you issued the original order.

          if (WantToChangeStop)
          {
          stopOrder = ExitOrder(amendedParameters ...);
          }

          where stopOrder is your original IOrder, and ExitOrder is the same type of order that you orignally issued.

          Comment


            #6
            Originally posted by tonynt View Post
            koganam,

            thank you for your reply!

            The broker is Dukascopy and is not supported by NT.

            Very sorry, I don´t understand how you mean. I do eg:

            if (stopOrder2a != null && stopOrder2a == order)
            {
            if (order.OrderState == OrderState.Accepted)
            CancelOrder(stopOrder1a); stopstep = 2;

            else if (order.OrderState == OrderState.Rejected)
            {
            exitOrder1a = ExitShort(1000, "x1a","T1");
            CancelOrder(stopOrder1a);
            CancelOrder(stopOrder2a);
            }
            }

            How would you do for submitting new stop "2a" and cancelling the stop "1a"?

            Thanks
            Tony
            Sorry, but we must be talking at cross-purposes here. Your original query gave me the impression that you were trying to replace an existing stop because some trigger condition had been met in the market. The code that you have posted looks more like you are taking an action based on an IOrder execution or update.

            That means that we are one step past the conditions that required an amended order, Seeing only the OnExecution() check code leaves me with a total lack of understanding of the mechanics of the code, so I cannot really make any sensible comment.

            Comment


              #7
              koganam,

              yes, I want to replace an existing stop because some trigger condition had been met. But "normal" SetStopLoss() I can not work with because I can not move the stop. I have to make a new one (and therefore delete the stop before). This - in my understanding - I can do only with IOrder. How else I could cancel a stop? Making a new stop is not the issue - but each stop I need to catch later on to delete if new conditions are met to make a new stop.

              How would you do it for using eg Donchian(Lower) as your stop and every time Donchian has an higher value to make a new stop and to cancel the old one? I thought the best would be to do a new stop with stopOrder++ and stoporder"value.ToString()

              How do you mean this would work better? I thank you for any idea.

              Best
              Tony

              Originally posted by koganam View Post
              Sorry, but we must be talking at cross-purposes here. Your original query gave me the impression that you were trying to replace an existing stop because some trigger condition had been met in the market. The code that you have posted looks more like you are taking an action based on an IOrder execution or update.

              That means that we are one step past the conditions that required an amended order, Seeing only the OnExecution() check code leaves me with a total lack of understanding of the mechanics of the code, so I cannot really make any sensible comment.

              Comment


                #8
                Originally posted by tonynt View Post
                koganam,

                yes, I want to replace an existing stop because some trigger condition had been met. But "normal" SetStopLoss() I can not work with because I can not move the stop. I have to make a new one (and therefore delete the stop before). This - in my understanding - I can do only with IOrder. How else I could cancel a stop? Making a new stop is not the issue - but each stop I need to catch later on to delete if new conditions are met to make a new stop.

                How would you do it for using eg Donchian(Lower) as your stop and every time Donchian has an higher value to make a new stop and to cancel the old one? I thought the best would be to do a new stop with stopOrder++ and stoporder"value.ToString()

                How do you mean this would work better? I thank you for any idea.

                Best
                Tony
                I do not understand. You are asking me a question that I answered 2 posts ago when I explained that all you need to do is issue the EXACT SAME ORDER with amended parameters, and let NT take care of the mechanics with the API. I even gave you the exact, generalized code.

                I do not know how else to say it. Sorry. Issue the exact same order with the new price. NT will take care of cancelling the existing order and issuing the new one. You do not need to worry about the mechanics under the cover: just issue the same order as the original order, changing ONLY the price at which you want to now execute.

                Comment


                  #9
                  koganam,

                  I have no idea what you mean. It sounds that this is more easy then I have done for weeks now. But when I do

                  if (Position.MarketPosition == MarketPosition.Long )
                  {
                  If(DonchianChannel(BarsArray[5],8).Lower[0]>DonchianChannel(BarsArray[5],8).Lower[1])
                  stopOrder1a = ExitOrder(0, true, 1000, Position.AvgPrice, "StopML1a", "ML1");

                  I get an error message like "ExitOrder not exists." (also when I do "private IOrder ExitOrder = null;" in the variables.

                  I´m not a programmer, I could only do using the NT-examples amending. And I have not seen before stopOrder=ExitOrder. Sorry.

                  Thanks
                  Tony

                  Originally posted by koganam View Post
                  I do not understand. You are asking me a question that I answered 2 posts ago when I explained that all you need to do is issue the EXACT SAME ORDER with amended parameters, and let NT take care of the mechanics with the API. I even gave you the exact, generalized code.

                  I do not know how else to say it. Sorry. Issue the exact same order with the new price. NT will take care of cancelling the existing order and issuing the new one. You do not need to worry about the mechanics under the cover: just issue the same order as the original order, changing ONLY the price at which you want to now execute.

                  Comment


                    #10
                    Hello Tony,

                    Thank you for your information and posts here.

                    If you would like I can review your code to take a look at this matter. While we do not provide debugging services we can take a look at your code and help point you in the right direction here.

                    If you prefer, you can send the code to support[at]ninjatrader[dot]com with 'ATTN: Patrick - 839527' in the subject line and a reference to this thread in the body of the e-mail: http://www.ninjatrader.com/support/f...ad.php?t=57615

                    Please let me know if I may be of assistance.

                    Comment


                      #11
                      Hello Tony,

                      Thank you for that information.

                      Instead of submitting multiple Stop Orders with different names, strings or IOrder. Just use one IOrder for all stops.

                      For example:
                      Code:
                      if(myCondition)
                      {
                      [B]stopOrder[/B] = ExitLongStop(0, true, 3000, execution.Order.AvgFillPrice -100 * TickSize, "StopML1a", "ML1");
                      }
                      if(myOtherCondition)
                      {
                      [B]stopOrder[/B] = ExitLongStop(0, true, 3000, [B]myNewStopPrice[/B], "StopML1a", "ML1");
                      }
                      Please let me know if I may be of further assistance.

                      Comment


                        #12
                        Hello,

                        thank you for your reply. OK, I changed and now I do as you posted here. But when using one name for stopOrder then in the output window there appear after change of stop (this seems logical as the condition is true also after changing the stop)

                        10.05.2013 12:50:14 Entered internal PlaceOrder() method at 10.05.2013 12:50:14: BarsInProgress=0 Action=BuyToCover OrderType=Stop Quantity=1.000 LimitPrice=0 StopPrice=1,3191'7 SignalName='StopD1b' FromEntrySignal='D1'
                        10.05.2013 12:50:14 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
                        ....
                        Thanks
                        Tony

                        Comment


                          #13
                          Hey tonynt,

                          If you are attempting to scale out of a position you will need to submit the orders with unique signal names and they must be at different prices.

                          Basically you will want to make a separate entry for each quantity to want to scale in and out with, and these will have their own signal names as well as price.


                          Let me know if that does not resolve your inquiry.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello,

                            thank you for your reply. Now I´m totally confused. Do you see the reply here above from Patrick? What is this for then?

                            Thanks
                            Tony

                            Originally posted by NinjaTrader_ChelseaB View Post
                            Hey tonynt,

                            If you are attempting to scale out of a position you will need to submit the orders with unique signal names and they must be at different prices.

                            Basically you will want to make a separate entry for each quantity to want to scale in and out with, and these will have their own signal names as well as price.


                            Let me know if that does not resolve your inquiry.

                            Comment


                              #15
                              Hello tonynt,

                              I did not actually see Patrick's post about this.

                              However, his method would work as well as it resolves the error of signal names and price levels.

                              Keeping the order price and signal name unique will work as well.


                              Thanks for pointing out Patrick has posted in this thread.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by NullPointStrategies, Today, 05:17 AM
                              0 responses
                              41 views
                              0 likes
                              Last Post NullPointStrategies  
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              124 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              64 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              41 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              46 views
                              0 likes
                              Last Post TheRealMorford  
                              Working...
                              X