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

OnOrderUpdate(IOrder order) doubt .??!!

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

    OnOrderUpdate(IOrder order) doubt .??!!

    if i use OnOrderUpdate(IOrder order) to reset the IOrder entryOrder to null
    program is not executing y so how to fix this .. pls help

    #2
    Deall, what snippet or call do you exactly use? Why don't you do the reset in OnExecution then as the fill is seen and as would be recommended in our reference samples on this topic?

    The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()
    BertrandNinjaTrader Customer Service

    Comment


      #3
      OMG ....... in my program everything fine only thing is i couldnt find the way correct way and how to reset the entryorder to null again ......... i tried the way in ur samples can pls tell em how to do exactly in the IExecution to reset entry order to null

      if i do like in the way in samples or in examples in help .. program not at all executing im breaking my head for a week with this issue

      Comment


        #4
        Deall, the correct and recommended way is exactly contained in the example. Since I would not know how you now implemented it, I would just simplify the script until it works as you would expect and only then begin adding more complex parts in. When dealing with this debugging process in strategies two items can be very helpful understanding the exact event sequence seen -

        1. TraceOrders - http://www.ninjatrader.com/support/f...ead.php?t=3627
        2. Print statements - http://www.ninjatrader.com/support/f...ead.php?t=3418

        This way you can exactly tell in which state you variables / IOrders are at any given point and see hopefully isolate the offending part.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          see this is my iexecution part in this where n how to reset entryorder to null rather than putting some links can u spot on the issue directly

          protected override void OnExecution(IExecution execution)
          {

          if (entryOrder != null && execution.Order != null && exitOrder == null )
          {
          Print("Bought price = " + execution.Price);

          }


          if (exitOrder != null && execution.Order != null)
          {
          Print("Closed@PositionAvgprice = " + execution.Price);


          }

          }

          Comment


            #6
            Deall, these links are posted and given purposeful abundantly in the forums as we believe it helps educating our user-base further and providing more value than 'fixing scripts'. For the reset you will spot this line in the SampleOnOrderUpdate example that is what you're after -

            if (entryOrder != null && entryOrder == execution.Order)
            if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
            if (execution.Order.OrderState != OrderState.PartFilled)
            entryOrder = null;
            BertrandNinjaTrader Customer Service

            Comment


              #7
              thnanks for ur sggestions n replys ....

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by TraderBCL, Today, 04:38 AM
              1 response
              6 views
              0 likes
              Last Post bltdavid  
              Started by martin70, 03-24-2023, 04:58 AM
              14 responses
              105 views
              0 likes
              Last Post martin70  
              Started by Radano, 06-10-2021, 01:40 AM
              19 responses
              606 views
              0 likes
              Last Post Radano
              by Radano
               
              Started by KenneGaray, Today, 03:48 AM
              0 responses
              4 views
              0 likes
              Last Post KenneGaray  
              Started by thanajo, 05-04-2021, 02:11 AM
              4 responses
              471 views
              0 likes
              Last Post tradingnasdaqprueba  
              Working...
              X