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

Setting a "Take Profit" order under a universal Stop?

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

    Setting a "Take Profit" order under a universal Stop?

    I have a working algo that would be improved by setting a "Take Profit Stop order" underneath my universal Stop Loss. I am new to C# (Think, Day old baby chicken) and want to do the following:
    On Long entries, set TakeProfit to 4 points for "x" number of contracts and let the rest ride.
    It may be advantageous to simply take profit on all contracts and wait for next signal, but I will need to back test to optimize and see.
    Disclaimer: I am just looking for examples to get me headed in the right direction and in no way hold anyone who shares advice, help, example code with me responsible for any losses that I may incur from my trading.
    Thanks for your help

    #2
    Hello emersontimmins,

    Thank you for your post.

    Profit Targets for a long order would need to be submitted above the current market price - I'm not sure exactly what you mean by "setting a "Take Profit Stop order" underneath my universal Stop Loss".

    If I'm reading this right, you want to scale out x number of contracts at 4 points of profit and you have a stop loss set for the full quantity, is that correct? How will the remainder of the position be exited?

    The simplest route would be to submit 2 separate orders using Signal Names to keep them differentiated instead of just one. This way you can use SetProfitTarget for the quantity you wish to be scaled out, and simply use a second SetStopLoss for this order set to the same as the SetStopLoss for the quantity you wish to remain open.

    If you can clarify your needs a bit more I'm happy to provide a simple example of this.

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you! An example would be great. I may just start simple and take profit at 4 points for all contracts and set a universal Stop Loss to limit trades that go against me. Thanks

      Comment


        #4
        Hello emersontimmins,

        Thank you for your reply.

        Here's a very simple example strategy that enters long for 4 contracts if the close price of the bar is greater than the open and it's not currently in a trade already. Point size may vary for different instruments but since Points aren't an option for setting profit targets and stops, I've used ticks - this would place the profit target at 4 points above the current price on instruments where there are 4 ticks to a point, such as ES or NQ.

        This should help you get started in the right direction.

        Please let us know if we may be of further assistance to you.
        Attached Files
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Thank you again Kate. I was not able to import that file into NT8 (said it was from an older version). Do you have a screen shot of it?
          I am going to start with a simple Take profit stop and then worry about selling partial contracts. I will put an OCO Stop embedded to take n-contracts and the universal Stop loss for n-contracts. I am just unsure as to how I arrange that in C#. I am learning but not seeing the full picture.

          Comment


            #6
            Hello emersontimmins,

            Thank you for your reply.

            Did you attempt to import it through Tools > Import > NinjaScript Add-on? Here's a complete walkthrough of how to import a NinjaScript file:

            To import NinjaScripts you will need the original .zip file.

            To Import
            1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
            2. From the Control Center window select the menu File> Utilities> Import NinjaScript
            3. Select the downloaded .zip file
            4. NinjaTrader will then confirm if the import has been successful.
            Please let me know if you're still unable to import and I will try to provide a different example.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mongo, Yesterday, 11:05 AM
            6 responses
            27 views
            0 likes
            Last Post Mongo
            by Mongo
             
            Started by ct, 05-07-2023, 12:31 PM
            7 responses
            206 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by wzgy0920, Yesterday, 09:53 PM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by Rapine Heihei, Yesterday, 07:51 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by kaywai, Today, 06:26 AM
            1 response
            6 views
            0 likes
            Last Post kaywai
            by kaywai
             
            Working...
            X