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

Multi Order tracking

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

    Multi Order tracking

    I have 2 problems :

    After being filled 1st order this code executes but:
    1) The profit target and stop loss of each entry ( twoB and treeB ) are not executed individually ; I want profit of entryorder2 = 12 ticks for entry2, and profit for entry3 = 9 but I dont get an individual profit ant target for each entry. How can I do ?
    Note : I have this setting :
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.UniqueEntries;
    2) How can I know the status of the position 1; I only know that the order was filled.

    entryOrder2 = EnterLongLimit(1, entry1 - 0.7 , "twoB");
    SetProfitTarget("twoB", CalculationMode.Ticks, 12);
    SetStopLoss("twoB", CalculationMode.Ticks, 15, false);
    DrawDot("Stop2B" + CurrentBar , 0, entry1 - 0.7, Color.Orange);

    entryOrder3 = EnterLongLimit(1, entry1 - 1.8 , "treeB");
    SetProfitTarget("treeB", CalculationMode.Ticks, 9);
    SetStopLoss("treeB", CalculationMode.Ticks, 8, false);
    DrawDot("Stop3B" + CurrentBar , 0, entry1 - 1.8, Color.Orange);
    pmaglio
    NinjaTrader Ecosystem Vendor - The Indicator Store

    #2
    Someone will respond later today.
    RayNinjaTrader Customer Service

    Comment


      #3
      I found something strange :
      Look at the picture, here are 2 orders (oneB and twoB) with profits=12 and StopLoss=15. Look at the way they are filled ;
      The results are the same (in this example) but order oneB was closed at Profit target of twoB. And order twoB was closed at target of oneB.
      I still dont understand how stop losses are being filled....

      Any help ?
      Attached Files
      pmaglio
      NinjaTrader Ecosystem Vendor - The Indicator Store

      Comment


        #4
        Hi pmaglio,

        I can't discern the code logic you have used just from the screenshot alone, but I highly recommend using TraceOrders to help debug orders.

        In regards to your question about submitting individual stoploss and profit target orders to each individual entrySignal, I suggest you place the Set() methods into the Initialize() method. Again, it is hard to discern what your overall system behavior should be from those contained snippets. Try using TraceOrders on a simple-as-possible strategy to first get an idea of how the Set() methods behave.

        You can know the status of your position through the use of IOrder objects. You can check the object with its OrderState in the OnOrderUpdate() method.

        Here are some reference samples that you may find useful: http://www.ninjatrader-support.com/v...ead.php?t=3917

        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Orders with different targets not working Ok

          Hi Josh,

          Just for duplicating the error with less code, I wrote new code to be tested with data of March 13 :
          We wait until LOW < 664.5 and then place 3 different EnterShortLimit ( one, two, tre ). Each one is placed after filled previous.
          Profits and targets are set at Initialize() as 12/15 for one and two and 9/8 for tre
          .
          What I get ( see the attached JPG ) are not the desired targets and profits..
          Where is the problem ?
          Attached Files
          pmaglio
          NinjaTrader Ecosystem Vendor - The Indicator Store

          Comment


            #6
            Hi pmaglio,

            I will take a look for you and report back my findings.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              What Ive seen is that the results are the same. The only difference is that for analysis purposes, the exit names are assigned wrong :
              Trade 1 : Exit by Stop loss (Ok)
              Trade 2 : Profit Target (Wrong ; it was a loss ) --> used target of trade 3
              Trade 3 : Stop Loss ( Wrong : It was a target ) --> used stop loss of trade 2
              pmaglio
              NinjaTrader Ecosystem Vendor - The Indicator Store

              Comment


                #8
                pmaglio,

                The fills are not wrong. Your orders are shorts. Stop losses are hit above your entry price and profit targets are hit below. The linking of stop loss and profit targets do seem intact on my end. Please make sure you are matching the correct orders with each other. Also, realize that on the chart it will show what you got filled at and not the price you submitted the order as. Use the TraceOrders print logs along with execution/orders logs to understand how it is behaving.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                40 views
                0 likes
                Last Post jeronymite  
                Started by bill2023, Today, 08:51 AM
                2 responses
                15 views
                0 likes
                Last Post bill2023  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                167 responses
                2,260 views
                0 likes
                Last Post jeronymite  
                Started by warreng86, 11-10-2020, 02:04 PM
                7 responses
                1,362 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by Perr0Grande, Today, 08:16 PM
                0 responses
                5 views
                0 likes
                Last Post Perr0Grande  
                Working...
                X