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

Script thinks order filled before it really filled

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

    #16
    Originally posted by NinjaTrader_Lance View Post
    Think of OnExecution as being triggered for your order intra bar. The daily candle that you see your order being filled on has not yet closed. Because of this you stop level is being based off of the most recent closed bar. This is where you see the read dot.
    That's the problem. Script should only place an order without placing StopLoss (red dot), because conditions was
    Code:
    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))
    				{...
    So, as I understood, strategy must place StopLoss ONLY after order fill. Is it? Because there is
    Code:
    OrderState.Filled
    What condition orders strategy to place StopLoss with EntryOrder?

    Comment


      #17
      Originally posted by alexstox View Post
      So, as I understood, strategy must place StopLoss ONLY after order fill. Is it?
      This is ultimately up to you but most traders would not prefer this, as doing so would potentially leave you in a naked position if the order is not completely filled.

      What is not working properly? What is your end goal?

      I strongly suggest using this OnExecution Template here for using IOrders: http://www.ninjatrader.com/support/f...ead.php?t=7499
      LanceNinjaTrader Customer Service

      Comment


        #18
        OK. Strategy entered once. Than, when conditions come true strategy enters again, and again. If I use entryOrder I should always "null" it every time conditions for entry come true. So, only opportunity to handle these orders is to set unique names. Enter1, Enter2 ... Enter10.

        Problem is in Enter2 can be when Enter1 live as order or as position.

        For every entry I need new "barNumberOfOrder", to have opportunity to calculate "highestHigh" from this bar and to track for trail stop.

        I'm confused

        Comment


          #19
          Sorry for my confusion but this issue doesn't seem to be the same as the issue previously discussed.

          So that I may clarify. Are you saying there is logic in your script that is triggering unexpectedly or that you're trying to come up with a way to manage and handle several different entry orders?
          LanceNinjaTrader Customer Service

          Comment


            #20
            I'm sorry for not so reasonable questions. I will check everything again and come back later

            Comment


              #21
              I use AOD data and Strategy Analyzer. Is it possible to trigger stop orders (buy stop < Close[0] || sell stop > Close[0]) as is, if set CalculateOnBarClose = false ???

              Comment


                #22
                Setting CalculateOnBarClose to false is not possible with the strategy analyzer but depending on the script you can sometime achieve similar results with a multi series script: http://www.ninjatrader.com/support/f...ead.php?t=6652

                This however would not be possible with EOD data and would require intraday historical data.

                Let me know if I can further assist.
                LanceNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GLFX005, Today, 03:23 AM
                0 responses
                1 view
                0 likes
                Last Post GLFX005
                by GLFX005
                 
                Started by XXtrader, Yesterday, 11:30 PM
                2 responses
                11 views
                0 likes
                Last Post XXtrader  
                Started by Waxavi, Today, 02:10 AM
                0 responses
                6 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                12 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                2 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Working...
                X