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

Other exits not possible when "Stops and Targets" defined?

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

    Other exits not possible when "Stops and Targets" defined?

    Hey there, I am using Strategy Builder to write my strategies. I have the following problem: When I define exits (stops and targets) under "Conditions and actions" they work fine, but when I add stops and/or targets under "Stops and Targets", my initially defined exits stop working. It seems, that any stop or target exit under "Stops and Targets" overwrites any other exits that have been defined. Is this the case or do I misunderstand anything? How can I define for example exits in both "Stops and Targets" and "Conditions and actions". I tried simply writing all my stops (initial and breakeven) under "Conditions and actions", but then in some cases, when the entry bar is really big and it passes already my intital stop the strat doesn't catch it, because it only calculates again on the next bar and realizes that it has entered and now has to issue the stop. Any advice? Thanks for helping out!

    #2
    Hello philmg,

    Thank you for the post.

    You are hitting one of the managed order handing rules when trying to use an exit and stoploss at the same time. That is prevented to avoid having a double exit. To make a stop and exit you would need to submit your own stop from a Set. You can see the following link for an example of submitting an order which also has a breakeven. You could just remove the break even part of the strategy to have a stop submitted from the Set.

    To have an exit and a stop would require using a variable and another set. When the condition to exit becomes true, set the variable to true. In another set check that the variable is true and exit. You also need to cancel the stop before doing this which will happen if you don't cal the order on each bar, it will expire. You could use the same variable to control the set which submits the stop order, if the variable is not true submit the stop order. When it becomes true it would stop submitting it.



    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you! The problem I always face with placing the stop via a separate set is the following:
      Let's say I have a 5 point stop from entry. On the entry bar the bar blasts 8 points past the entry level and goes beyond the stop level in some rare cases. The stop will only be calculated on the next bar after the entry bar right? When I enter stops in the "Stops and Targets" window, the stop is active immediately. Is there a way to make sure, that the stop is active immediately with the entry?

      Comment


        #4
        Hello philmg,

        For a target to be placed with the entry you would need to submit those two orders at the same time. The tops and targts page uses the Set methods which would be tied to the entries fill. If you have logic which checks a condition before entering the target then you would need to wait at the frequency of the calculation which could be on each bar..


        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by PhillT, Today, 02:16 PM
        2 responses
        6 views
        0 likes
        Last Post PhillT
        by PhillT
         
        Started by Kaledus, Today, 01:29 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by frankthearm, Yesterday, 09:08 AM
        14 responses
        47 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by gentlebenthebear, Today, 01:30 AM
        2 responses
        14 views
        0 likes
        Last Post gentlebenthebear  
        Started by PaulMohn, Today, 12:36 PM
        2 responses
        17 views
        0 likes
        Last Post PaulMohn  
        Working...
        X