• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Print the current stop order

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

    Print the current stop order

    I am trying to get the value of the current stop order however what I have doesn't seem to work

    Print(ExitLongStop + "ExitLongStop " + Time[0]);

    #2
    fiddy, what print are you seeing then with this call? Is ExitLongStop a variable that would be expected to hold your current stop value?

    To directly access the properties of any order, please work with the IOrder interface -

    http://www.ninjatrader.com/support/h...nt7/iorder.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Could you provide example of how to request the stopprice of an order from within the iorder interface

      Comment


        #4
        Surething, you would need to submit your order with an IOrder reference first to have access to it -

        if (myIOrder == null)
        myIOrder = ExitLongStop(1000);

        if (myIOrder != null)
        Print(myIOrder.StopPrice);
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Are you able to have two IOrder's at same time

          I tried to create mystoporder and mytrailorder

          however I get the following error msg

          Cannot implicity convert 'void' to NinjaTrader.Cbi.IOrder

          Comment


            #6
            You could create multiple IOrder objects, however as I have explained the other thread of yours in managed mode you then easily run into the managed mode order handling rules - just working with one order would be here and then updating the stop level as desired dynamically from your code to provide the trail aspects.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Thanks for the advice, in order to achieve the same affect as a trailing stop do I have to set the calculationonbarclose to false. Correct?

              In backtesting will the results be the same?

              Comment


                #8
                CalculateOnBarClose is always true in backtesting. If you would want to simulate trailing on a tick by tick basis the actual trail stop logic would have to be worked in using a finer series i.e tick one in your strategy script. The same would hold for the SetTrailStop, in backtesting it would be based on your primary series with CalculateOnBarClose = true only.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Missing Stops

                  Hi Bertrand

                  I have tried to create a trail stop system using IOrder as you suggested

                  Attached is the code.
                  The problem I have is that in some instances the market doesn't acknowledge the stop in place.
                  even though I know they are there as I have printed out stops at various time to ensure that they are correct.

                  Also in some instances the code seems to work as I would expect.
                  Any suggestions to find out why the stops aren't working?
                  Attached Files

                  Comment


                    #10
                    Hi fiddy, for the time when the stop seems ignored, what TraceOrders print would you see? That's usually the best way to start debugging such scenarios alongside the Prints you already have implemented - http://www.ninjatrader.com/support/h...ub=TraceOrders
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Thanks for advice

                      The Stop gets placed correctly however for some reason it is cancelled later due to expiring.
                      What would cause the order to expire on ExitLongStop?

                      31/03/2012 5:00:00 AM Entered internal PlaceOrder() method at 31/03/2012 5:00:00 AM: BarsInProgress=0 Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=1.0303 SignalName='' FromEntrySignal=''


                      3/04/2012 5:00:00 AM Cancelled expired order: BarsInProgress=0: Order='NT-00001/Backtest' Name='Sell' State=Working Instrument='$AUDUSD' Action=Sell Limit price=0 Stop price=1.0303 Quantity=0 Strategy='Pinstar' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='59806abdcfc24ad9bfebdbe803c3a5cb' Gtd='1/12/2099 12:00:00 AM'

                      Comment


                        #12
                        fiddy, per default those stops would expire on the next bar update seen. You can persist them with setting the liveUntilCancelled to true in the advanced overload offered for ExitLongStop. Then only the end of session handling would cancel any open orders of those.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Would this work

                          ExitLongStop(1,true,DefaultQuantity,Close[0] - (.5*StopDistance ),"","");

                          Comment


                            #14
                            Correct, that's how you would set them to not expire but persist until session end.
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              Do I need to put anything to replace the "" as the below is still giving same issue of the stop order expiring

                              ExitLongStop(1,true,DefaultQuantity,Close[0] - (.5*StopDistance ),"","");

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ajay8000, Yesterday, 11:31 PM
                              5 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_Marco  
                              Started by simjs, Yesterday, 11:23 PM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_ChrisSch  
                              Started by akuntysh, Yesterday, 10:41 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post akuntysh  
                              Started by Wolf1, Yesterday, 08:26 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post Wolf1
                              by Wolf1
                               
                              Started by pparmley, Yesterday, 04:30 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post pparmley  
                              Working...
                              X