Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

limit entries and oco

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

    limit entries and oco

    In using the EnterLongStopLimit and EnterShortStopLimit methods
    with the stopPrice specified in the method does this make the SetStopLoss specified in the initialise redundant and only need the SetProfitTarget?
    Or do i need to specify both SetStopLoss and SetProfitTarget in order to have the OCO capability for the limit entry? ie does the stop set in the EnterLongStopLimit link as OCO to the SetProfitTarget setting?

    Also just to check if the limit sits there and isnt filled and market moves away what is the best way to remove/cancel the unfilled limit without stopping the strategy or do we need to stop strategy or cancel from the control panel? there is nothing we can do on the chart itself given that chart trader needs to be disabled?

    thanks in advance

    #2
    Hello Soulfx,

    Thank you for your post.

    The stop price is for the Stop Limit orders themselves, not for a SetStopLoss() order. You will want to set a StopLoss() order separately.


    Or do i need to specify both SetStopLoss and SetProfitTarget in order to have the OCO capability for the limit entry?
    The OCO will not apply to the limit entry. It will only apply to the SetStopLoss() and ProfitTarget() order when the entry is filled.

    You can use CancelOrder() to cancel an order that would still be working. This will require that you use the IOrder object handling for your orders so it can specify which order directly to cancel.
    IOrder Handling
    CancelOrder() method
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Ok understand the stopPrice in the EnterLongStopLimit defines the price to be triggered and when the limit order is placed at limit price. Obviously this varies depending on strategy and approach i can be
      1. same as stop price
      2. ticks less than the stop prices
      3. ticks greater than the stop price - which potentially makes it a marketable order.

      In the case of 3 .. is it subject to slippage like with a market order? Ie changing it to be a market order and execute as best price?

      Is there any recommended approach or postings on whether to set the limit price for this method to be same as stop price trigger or less than?

      In reference to the cancelorder i can manage this within the strategy once a condition has been satisfied eg after x number of bars or x time elapsed. If one stops the strategy from the UI it will cancel and flatten all orders pertaining to the strategy?

      Can the order be cancelled at all from the control center Orders tab or is this not accessible and indeed once executed can the stop and profit targets be modified from the amounts preset in the SetProfitTarget and SetStopLoss in the initialise

      thank you for help

      Comment


        #4
        Soulfx,

        Yes, as a market order it would be subject to slippage.

        There are no recommended approaches as this is going to depend on your trading style and how you feel to enter/exit the market.

        If you stop the strategy, by default the exit orders will be cancelled not the entries. You can change this by going to Tools -> Strategies -> NinjaScript Tab -> Select "Cancel entry orders when a strategy is disabled".
        Additionally, any positions open will remain this way. You would need to add in OnTermination() method to clean up and positions that you may have when disabling the strategy.
        OnTermination() Method

        Yes, you can cancel the working orders from the orders tab, as this shows all the orders that have been submitted, however it is not recommended to do this as it can harm your strategy logic for tracking these orders and positions.

        Let me know if I can be of further assistance.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Cal View Post
          Soulfx,

          Yes, as a market order it would be subject to slippage.

          There are no recommended approaches as this is going to depend on your trading style and how you feel to enter/exit the market.

          If you stop the strategy, by default the exit orders will be cancelled not the entries. You can change this by going to Tools -> Strategies -> NinjaScript Tab -> Select "Cancel entry orders when a strategy is disabled".
          Additionally, any positions open will remain this way. You would need to add in OnTermination() method to clean up and positions that you may have when disabling the strategy.
          OnTermination() Method




          Yes, you can cancel the working orders from the orders tab, as this shows all the orders that have been submitted, however it is not recommended to do this as it can harm your strategy logic for tracking these orders and positions.



          thanks
          Let me know if I can be of further assistance.
          So if i select this in tools -> Strategies entry orders being those that are pending as in pending limit orders? or live entries? as for SetStopLoss and SetProfittarget these are issued when the limit is filled for an EnterLongStopLimit method? ie the exit orders are not submitted until a fill or are you talking about the Exit() methods available. Just want to clarify.




          Can the stop and profit targets be modified in the control panel using this managed order approach?

          To scale and move stops to breakeven either this needs to be done using the ATMStrategy format or the IOrder approach which is more advanced?

          Is it still problematic to use ATMStrategies in Strategies or does this work ok i have heard mixed views on this and requires alot more error checking?

          One last note here if i use the Performance.RealtimeTrades.TradesPerformance.Point s.CumProfit

          to check in points/ticks the profit loss ie > 20 ticks or < -20 ticks
          is the best way to stop the strategy for this kind of test or against $profit/loss to do this at beginning of onbarupdate and return or to trigger the onTermination in some way or is onTermination only when the strategy is disabled?

          thanks

          Comment


            #6
            Originally posted by soulfx View Post
            So if i select this in tools -> Strategies entry orders being those that are pending as in pending limit orders? or live entries? as for SetStopLoss and SetProfittarget these are issued when the limit is filled for an EnterLongStopLimit method? ie the exit orders are not submitted until a fill or are you talking about the Exit() methods available. Just want to clarify.




            Can the stop and profit targets be modified in the control panel using this managed order approach?

            To scale and move stops to breakeven either this needs to be done using the ATMStrategy format or the IOrder approach which is more advanced?

            Is it still problematic to use ATMStrategies in Strategies or does this work ok i have heard mixed views on this and requires alot more error checking?

            One last note here if i use the Performance.RealtimeTrades.TradesPerformance.Point s.CumProfit

            to check in points/ticks the profit loss ie > 20 ticks or < -20 ticks
            is the best way to stop the strategy for this kind of test or against $profit/loss to do this at beginning of onbarupdate and return or to trigger the onTermination in some way or is onTermination only when the strategy is disabled?

            thanks
            Soulfx,

            This will be the pending orders submitted by the strategy.

            The Set() orders are submitted when the entry is filled.

            Exit() orders can be submitted anytime you wish in your code, these are designed to be only exit orders for the position that they are used for. E.G. ExitLong() is a market order against a long position.

            You can modify the Stop and Profit orders, however please note that the stratey will update them on the next time that OnBarUpdate() is called, whether on the bar close on or on every tick. This setting is determined by CalculateOnBarClose.

            The IOrder is more of an advanced approach for handling the logic, but less checks for objects while with ATMs, the logic is handled by the ATM but there are additional checks for strings and order objects.

            OnTermination() is only called when the strategy is disabled or reloaded.
            Checking the profit at the beginning of the OnBarUpdate() would allow you to check your performance before doing and trade calculations.
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Cal View Post
              Soulfx,

              This will be the pending orders submitted by the strategy.

              The Set() orders are submitted when the entry is filled.

              Exit() orders can be submitted anytime you wish in your code, these are designed to be only exit orders for the position that they are used for. E.G. ExitLong() is a market order against a long position.

              You can modify the Stop and Profit orders, however please note that the stratey will update them on the next time that OnBarUpdate() is called, whether on the bar close on or on every tick. This setting is determined by CalculateOnBarClose.

              The IOrder is more of an advanced approach for handling the logic, but less checks for objects while with ATMs, the logic is handled by the ATM but there are additional checks for strings and order objects.

              OnTermination() is only called when the strategy is disabled or reloaded.
              Checking the profit at the beginning of the OnBarUpdate() would allow you to check your performance before doing and trade calculations.
              Thank you for the reply.

              Performance.RealtimeTrades.TradesPerformance.Point s.CumProfit

              In testing and using the above i wanted to check on the CumProfit for Realtimetrades
              is this the value for the strategy or for the account as a whole and matches the value in the Realized Pnl column in the Accounts tab of the control panel.
              I want to check if the strategy was stopped and restarted after a loss or profit target if the CumProfit would start from 0 or would be compared to the current value in Accounts tab. Just to be clear if running strategy on multiple contracts how to keep profit ticks local to the strategy or as i can adjust input parameter.
              On observation on stopping and restarting it seems the realized profit is reset to 0 and this is what the above Points.CumProfit would show.

              As per your confirmation i just return at the top of onbarupdate is this the best approach or is there a way to then stop the strategy or this can only be achieved via the control panel strategies tab?

              Can i also just confirm and i see seems to be the case in testing the default for using EnterLongStopLimit is that IF the limit is not triggered before the close of the current bar this order will be cancelled - IF it is filled then there is no intervention and it is left to run to defined preset stop and profit targets?

              thank you so much

              Comment


                #8
                Originally posted by NinjaTrader_Cal View Post
                Soulfx,

                This will be the pending orders submitted by the strategy.

                The Set() orders are submitted when the entry is filled.

                Exit() orders can be submitted anytime you wish in your code, these are designed to be only exit orders for the position that they are used for. E.G. ExitLong() is a market order against a long position.

                You can modify the Stop and Profit orders, however please note that the stratey will update them on the next time that OnBarUpdate() is called, whether on the bar close on or on every tick. This setting is determined by CalculateOnBarClose.

                The IOrder is more of an advanced approach for handling the logic, but less checks for objects while with ATMs, the logic is handled by the ATM but there are additional checks for strings and order objects.

                OnTermination() is only called when the strategy is disabled or reloaded.
                Checking the profit at the beginning of the OnBarUpdate() would allow you to check your performance before doing and trade calculations.
                Thank you for the reply.

                Performance.RealtimeTrades.TradesPerformance.Point s.CumProfit

                In testing and using the above i wanted to check on the CumProfit for Realtimetrades
                is this the value for the strategy or for the account as a whole and matches the value in the Realized Pnl column in the Accounts tab of the control panel.
                I want to check if the strategy was stopped and restarted after a loss or profit target if the CumProfit would start from 0 or would be compared to the current value in Accounts tab. Just to be clear if running strategy on multiple contracts how to keep profit ticks local to the strategy or as i can adjust input parameter.
                On observation on stopping and restarting it seems the realized profit is reset to 0 and this is what the above Points.CumProfit would show.

                As per your confirmation i just return at the top of onbarupdate is this the best approach or is there a way to then stop the strategy or this can only be achieved via the control panel strategies tab?



                thank you so much

                Comment


                  #9
                  Hello did someone see this reply from me ? want to check as i have few other questions.
                  If it matters i have lifetime license
                  thanks

                  Comment


                    #10
                    Soulfx,

                    These values are going to be the Strategy's performance, not the entire account.

                    I want to check if the strategy was stopped and restarted after a loss or profit target if the CumProfit would start from 0 or would be compared to the current value in Accounts tab.
                    The CumProfit would be reset back to 0 when you started the strategy back up.

                    Just to be clear if running strategy on multiple contracts how to keep profit ticks local to the strategy or as i can adjust input parameter.
                    You can create a User Defined Parameter that will allow you to set this value to the different strategy instances per instrument that you are running

                    You would want to use Disable() if the condition is true. This will stop the strategy entirely.
                    Cal H.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by inanazsocial, Today, 01:15 AM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_Jason  
                    Started by rocketman7, Today, 02:12 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post rocketman7  
                    Started by dustydbayer, Today, 01:59 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post dustydbayer  
                    Started by trilliantrader, 04-18-2024, 08:16 AM
                    5 responses
                    23 views
                    0 likes
                    Last Post trilliantrader  
                    Started by Davidtowleii, Today, 12:15 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post Davidtowleii  
                    Working...
                    X