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

2 questions about order management

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

    2 questions about order management

    Hi All,

    I spent most of yesterday reading your references on Order Management, Advanced Order Management and relevant examples. I still can't quite get the behaviour I am looking for/expecting from NT. Hopefully you can help.

    Question 1:

    If I enter a Long position via EnterLong() and set a stop loss for this order via SetStopLoss() - both from within OnBarUpdate() - is it possible for me to simply exit the order (via ExitLong) when certain conditions are met...? If so, how would I do it...? Would I have to cancel the stop first? Or is it simply not possible at all?

    Question 2:

    If I have entered a Long position via EnterLong() within OnBarUpdate(), and subsequently set a stop loss for the order via ExitLongStop() within OnOrderUpdate(), then similar to above, how do I change the existing stop order to an 'at market' exit order when certain conditions are met...? At the moment I am calling CancelOrder(the stop order) first, which works fine, but any subsequent ExitLong() that I call seems to have no effect. Any ideas?

    Many Thanks

    #2
    Also guys if I can another question too...

    I'm using a multi-time frame strategy. 5min for signals, 1 min for execution.
    My EnterLong() is called on the 1 min dataseries. If I then place a SetStopLoss() against this long position is it automatically placed for execution in the 1 min dataseries...? If so, is there a way with the Set() methods to force the stop to be placed for execution in another (e.g. 5 min) time series. I ask because obviously the Set() methods have no reference to a BarsInProgress parameter.

    Many Thanks

    (p.s. This is all from a backtesting point of view. The real world would obviously not work like this.)
    Last edited by Sidhartha; 04-09-2008, 05:43 AM.

    Comment


      #3
      At the risk of being declared insane for talking to myself, I have gathered from other material I've read that Set() methods can't be cancelled... is that correct...??

      Also, is it possible to replicate a market order by changing (for example) the stop price of a short stop loss to below the current market close...? I seem to be getting log errors here...

      I'd appreciate it if one you order management guru's could cast your eye over this...?

      Thanks
      Last edited by Sidhartha; 04-09-2008, 10:53 AM.

      Comment


        #4
        1) Your understanding is correct

        2) Unfortunately not for stop orders since most if not all exchanged would reject an order if for example a buy stop was placed below the last traded price. Limit orders you can.
        RayNinjaTrader Customer Service

        Comment


          #5
          Thanks Ray. Just to push two further points I made below... for reference...

          1. I'm using a multi-time frame strategy. 5min for signals, 1 min for execution.
          My EnterLong() is called on the 1 min dataseries. If I then place a SetStopLoss() against this long position is it automatically placed for execution in the 1 min dataseries...? If so, is there a way with the Set() methods to force the stop to be placed for execution in another (e.g. 5 min) time series. I ask because obviously the Set() methods have no reference to a BarsInProgress parameter.

          2. If I have entered a Long position via EnterLong() within OnBarUpdate(), and subsequently set a stop loss for the order via ExitLongStop() within OnOrderUpdate(), then similar to above, how do I change the existing stop order to an 'at market' exit order when certain conditions are met...? At the moment I am calling CancelOrder(the stop order) first, which works fine, but any subsequent ExitLong() that I call seems to have no effect. Any ideas?

          I am getting to the bottom of this. Hopefully I'll be out of your hair soon!!!

          Comment


            #6
            1) No there is not.

            2) If you have called ExitLongStop() and then a condition is true to exit, just call ExitLong()...A market order will go through and the stop will be cancelled.
            RayNinjaTrader Customer Service

            Comment


              #7
              Many Thanks

              Comment


                #8
                You've probably solved this problem already, but...

                Originally posted by Sidhartha View Post
                1. I'm using a multi-time frame strategy. 5min for signals, 1 min for execution.
                My EnterLong() is called on the 1 min dataseries. If I then place a SetStopLoss() against this long position is it automatically placed for execution in the 1 min dataseries...? If so, is there a way with the Set() methods to force the stop to be placed for execution in another (e.g. 5 min) time series. I ask because obviously the Set() methods have no reference to a BarsInProgress parameter.
                The SetStopLoss() method takes a fromEntrySignal parameter, so if you want to adjust the stoploss of one particular entry that was made on a different time frame, you can specify the signal.

                So you could enter long with a signal ("Long " + BarsInProgress) so when you need to adjust the stop, you can refer to it directly:

                Code:
                if( BarsInProgress == 1 ) {
                   SetStopLoss("Long 0", CalculationMode.Price, 100, false);
                }
                The stoploss affects all running strategies, but by tweaking the signal name, you can get it to apply to different entries, different instruments or different BarInProgress's.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by swestendorf, Today, 11:14 AM
                1 response
                1 view
                0 likes
                Last Post swestendorf  
                Started by Sparkyboy, Today, 10:57 AM
                0 responses
                4 views
                0 likes
                Last Post Sparkyboy  
                Started by TheMarlin801, 10-13-2020, 01:40 AM
                21 responses
                3,917 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by timmbbo, 07-05-2023, 10:21 PM
                3 responses
                156 views
                0 likes
                Last Post grayfrog  
                Started by Lumbeezl, 01-11-2022, 06:50 PM
                30 responses
                812 views
                1 like
                Last Post grayfrog  
                Working...
                X