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

Strategy Builder: StopLoss at the MAX of the last 10 bars...not working... why?

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

    Strategy Builder: StopLoss at the MAX of the last 10 bars...not working... why?

    Hi there, using the Strat Builder, I wanted to set the StopLoss for a Short entry to be at the MAX of the last 10 bars + 10 ticks (as an example).
    However, when running the playback, the stop loss gets completely ignored. Has anybody managed to get this done? I feel the Strat Builder should allow for this, after all the SL window does offer the user to decide where the stop loss should, using indicators, offsets etc.

    Thanks!

    #2
    Hello Oracletrades,

    Thanks for your post.

    If you are using the Set methods from the Stops and Targets window then please note that these are fixed values that are set when the strategy is applied. These cannot be used dynamically such as you are showing (in the strategy builder). I would recommend using the Stops an targets with fixed values using the CalculationMode of Ticks and specifying the number of ticks from the entry to use,

    If you want to use the set methods dynamically, it is possible to do so however you would have to unlock the strategy and work directly in Ninjascript. Once unlocked you would not be able to use the strategy builder on that particular strategy.

    Alternatively, in the Strategy Builder, you can create your own profit and stop by using other order types. For example (long position) , profit target orders are Exit long by a limit order, Exit long by a market if touched order. Exit Long can be used for a profit or stop (it is a market order so it fills immediately). Stop orders are: Exit long by a stop order, ExitLong by a stop limit order. So these order types can be dynamically set.

    Please note that a limit type order will be automatically canceled if not filled on the bar that it is placed. This means you would need to create logic to continue to place the order until it does fill or you no longer need the order.

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul, thanks for that detailed reply. That is a really good idea and the reason I hadn't thought of doing it that way is because of what you say: every new bar the limit orders get "wiped" from the strategy builder. When you say:

      This means you would need to create logic to continue to place the order until it does fill or you no longer need the order.
      ... is there any documentation anywhere that you know of that would outline how to do this? The results of many strategies changes dramatically when an order is allowed to stay "alive" after a bar closes... It's a shame this option is only available to coders and developers in my opinion.

      Comment


        #4
        Hello Oracletrades,

        Thanks for your reply.

        If you want to unlock the Strategy builder created strategy and work directly in Ninjascript then you can use the advance Order handling which allows for Live until canceled options. The programmer then would need to also handle the canceling of any orders.

        If you want to remain in the Strategy Builder then you would need to set up your strategy so that once you are in a position, that you submit your exit limit orders. So the criteria would be that you are in a market position (long or short) and submit the exit limit order which will be resubmitted on each bar until you fill the order (because the market position changes). Here is a link to the strategy builder help guide on MarketPosition as a condition: https://ninjatrader.com/support/help...ionComparisons
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          If you used ExitShort instead of StopLoss when your conditions are met, I think you will be closer to your goal. Yes, you cannot exit exactly at the stop price with ExitShort order, but it will be close.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Aviram Y, Today, 05:29 AM
          0 responses
          1 view
          0 likes
          Last Post Aviram Y  
          Started by quantismo, 04-17-2024, 05:13 PM
          3 responses
          25 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by ScottWalsh, 04-16-2024, 04:29 PM
          7 responses
          34 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cls71, Today, 04:45 AM
          0 responses
          6 views
          0 likes
          Last Post cls71
          by cls71
           
          Started by mjairg, 07-20-2023, 11:57 PM
          3 responses
          216 views
          1 like
          Last Post PaulMohn  
          Working...
          X