Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Wizard - Profit Targets & Stop Loss

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

    Strategy Wizard - Profit Targets & Stop Loss

    Hi,

    Is there a way to include 2 separate profit targets using the Strategy Wizard. I have put together the strategy and it works as intended but I would like to include the following:

    For example,

    2 targets, initial stop loss of -10 ticks
    Exit 1st contract at 5 ticks & move stop to Entry - 5 ticks
    Exit 2nd contract at 10 ticks

    Thank You,

    Danny.

    #2
    Hello DannyS,

    Yes, you can multiple entries and multiple stop losses and profit targets using the strategy wizard.

    To do this, you will need to use entry signals for the entry orders and have those match the fromEntrySignal of the exit order.

    You will also need to set EntriesPerDirection to 3 in the strategy parameters when running the script.


    Attached is an example of multiple orders using the Strategy Wizard.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank You for the reply. I got it figured out.

      However, The are a few other problems that I've encountered now:

      1) The strategy seems to be taking multiple subsequent entries in the same direction - I would like it to only take 1 entry with the defined amount of contracts (i.e. 2) and ONLY take another entry if the previous one had closed. In other words, only enter a new trade once the previous one had ended.

      2) How do I trail the stop for the second contract by a defined amount of ticks from the entry AFTER the first target had been hit ?

      Thanks,

      Danny.

      Comment


        #4
        Hello DannyS,

        If you are waiting to be flat before placing a second order, then you are not using multiple targets. You would just have one target and one order.

        If you want to prevent further orders when you are in a position, add to the conditions for entry the Position.MarketPosition == MarketPosition.Flat. This would make it so the strategy must be flat to enter a new order.

        (In the condition builder select Strategy -> Current market position, on the right select Strategy -> Flat)
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank You Chelsea, that helped.

          What about my second issue below of trailing the stop a certain fixed ticks from the price?

          Thanks,

          Danny.

          Comment


            #6
            Hi DannyS,

            Attached is an example of a trail using the Strategy Wizard.

            Your logic will need to be correct to start the trail after the first target has closed.

            Basically, once the price reaches the price of the first target or stop, then this would create a flag to start the trailing action.

            This would actually be easier to hand code than trying to use the wizard which is not meant for complex logic such as this.


            However, you mentioned that your second entry order would not be submitted until after the first trade is closed, is this still the case?
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Chelsea,

              I had the same issue with my strategy--close crossing above or below a pivot line--where the strategy would buy another contract while still holding a contract. Sometimes price can vacillate on a line and has the strategy buy extra contracts. I tried adding Position.MarketPosition == MarketPosition.Flat using the condition builder but then the strategy never enters in that direction at all. I put the condition in short entries only in a long/short based strategy.

              Long condition--1. close cross above pivot line

              Short conditions--1. close cross below pivot line
              2. Position.MarketPosition == MarketPosition.Flat

              The strategy never goes short. Any thoughts?
              Last edited by LTWCI; 02-26-2015, 01:32 PM.

              Comment


                #8
                Hello LTWCI,

                If you would like to prevent a strategy from being able to place more than one order per bar (so that fluxuations do not allow several orders to be submitted repeatedly), you would need to unlock your script and code your script by hand.

                What would be need is a flag after the order is place such as setting a bool from false to true, and then set this back when there is a new bar by using FirstTickOfBar.

                Below is a link to the help guide on FirstTickOfBar.
                http://www.ninjatrader.com/support/h...ttickofbar.htm

                For example:

                In #region Variables:
                private bool orderPlacedOnThisBar = false;

                In OnBarUpdate() where your order is placed:
                if (FirstTickOfBar)
                orderPlacedOnThisBar = false;

                if (/* criteria to enter long order here && */ orderPlacedOnThisBar == false)
                {
                EnterLong();
                orderPlacedOnThisBar = true;
                }

                This would if affect allow only one order submitted with this code for each bar even if the script is set to run with Calculate on bar close set to False.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by samish18, Yesterday, 08:31 AM
                4 responses
                14 views
                0 likes
                Last Post elirion
                by elirion
                 
                Started by funk10101, Yesterday, 09:43 PM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                5 responses
                551 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by rtwave, 04-12-2024, 09:30 AM
                5 responses
                37 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by funk10101, Today, 12:02 AM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Working...
                X