Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Using IOrder in a Strategy

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

    Using IOrder in a Strategy

    I have read the information in your help guide regarding IOrder and IPosition. I am still confused as to the exact text to use in the code. WHat I would like to do is Modify the stoploss oder for a specific entry order which I have "tagged" during the entry code.

    #2
    clfield,

    Welcome to the NinjaTrader Support Forums. What you want to do does not require IOrders. Please check out this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=3222
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Yes I have reviewed the material you mentioned. I am trying to track two different entry orders and their corsponding stop loss and Limit orders. Namely I am need to access the entry price and state of each entry order.
      Thanks for your quick reply.

      Comment


        #4
        Let's start from the basic requirement.

        - You wish to modify a stop loss order
        - Is this stop loss submitted via SetStopLoss() or ExitLongStop()/ExitShortStop()
        RayNinjaTrader Customer Service

        Comment


          #5
          I have a strategy that will enter two positions,"Proffit1" which has a fixed stoploss order set in the initialize section and "Proffit2" which I set and modify the stopLoss for in the BarUpdate section.
          I want to be able to enter a second set of orders "Proffit3" and Profit"4" before the first set of orders have reached their respective targets. "Profit 3 would have a fixed stoploss set in the initialize secxtion. My problem is in managing the "proffit4" Stoploss order independent of the "Profit 3" Stoploss order.
          I have been trying to use the Average entry price to determine my breakeven, however this price is the average of the 4 orders after the 2nd set of orders is placed.
          I found the "Client" class in the NT help section and was hoping I could use the AvgFillPrice(string orderId) to get the average price for each descreet entry and the OrderStatus(string orderId) to detemine when the order had been filled. But the help section does not shpw any examples and I am not sure of the exact code needed.

          Thanks for you help

          Comment


            #6
            clfield,

            You should be able to manage each one individually. Please use unique Entry Signal names for each and then you can distinguish which profit target goes with which entry order. To figure out your breakeven for the fourth order you will just need to run your own calculation by hand. If your fourth order has an IOrder attached to it you can access the fill price of that IOrder object. myOrder.AvgFillPrice will do the trick.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Please elaborate on myOrder.AvgFillPrice will do the trick. Is this an Iorder Object? I have done a fair amount of programming but this part of it just seems to be a morass. It would be extremely helpful if one could access the state of an order and the average fill price without having to write 400 lines of code.

              Comment


                #8
                It is a property of the IOrder object. Please see the Help Guide for more information here: http://www.ninjatrader-support.com/H...V6/IOrder.html
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Haiasi, Today, 06:53 PM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by ScottWalsh, Today, 06:52 PM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by ScottW, Today, 06:09 PM
                1 response
                4 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by ftsc2022, 10-25-2022, 12:03 PM
                5 responses
                256 views
                0 likes
                Last Post KeyonMatthews  
                Started by Board game geek, 10-29-2023, 12:00 PM
                14 responses
                244 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Working...
                X