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:Monthly Filter and Stop Loss

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

    Strategy Builder:Monthly Filter and Stop Loss

    Hello,

    1. is it possible to make a monthly filter at the strategy builder.For example the strategy should not trade in december?

    2.i made a strategy and i set an stop loss and a trailing stop but the trailing stop is not working.Can i not run a stop loss and trailing stop at the same time?

    best regards

    tobias

    #2
    Hello tobiaste,

    Thanks for your post and welcome to the NinjaTrader forums!!

    Yes, it is possible and it is difficult due to the limitations of the strategy Builder.

    You would create a filter based on actual dates, for example 12/1/2020 through 12/31/2020 which means that you would have to update the filter each year.

    I've attached an example of the type of logic you would need in a strategy builder example.

    If you apply this to a daily chart, it will color the background over the days it would trade. If you check the check box "Exclude October" Then you would see that the background for the current month of October would not be colored.

    The strategy has an internal variable bool called "TradeOctober" which is set to true by default and importantly is set true in Set 1 without conditions meaning that on every bar it will be true. Next in set 2 is the actual filter and if the time is between the first and last day of October AND if you have set the user input "ExcludeOctober" as true, set 2 will set "TradeOctober" to false. Finally to demonstrate the exclusion, Set 3 checks if the bool TradeOctober is true and if so colors the background.

    In your strategy, you would use the state of bool TradeOctober as part of your entry conditions.

    MonthlyFilterExample.zip
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello tobiaste,

      I forgot to answer your second question, "Can i not run a stop loss and trailing stop at the same time?".

      You cannot run the trailing stop and the fixed stop on the same order, if so, the trailing stop is not used. You can use one or the other.

      It is possible to use the fixed stop on one order and a trailing stop on another order and this is done by using entry signal names to tie the entry order to the trailing stop.
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_PaulH View Post
        Hello tobiaste,

        I forgot to answer your second question, "Can i not run a stop loss and trailing stop at the same time?".

        You cannot run the trailing stop and the fixed stop on the same order, if so, the trailing stop is not used. You can use one or the other.

        It is possible to use the fixed stop on one order and a trailing stop on another order and this is done by using entry signal names to tie the entry order to the trailing stop.
        hello,

        thank you for your answer . Can you maybe make an example who i can do that?

        Comment


          #5
          Hello tobiaste,

          Thanks for your reply.

          In this case, I can describe the process.

          In your set that places an entry order, you would place two EnterLong() orders. In each one, you would create a unique signal name into the order., for example "Long1" and "Long2".

          In the "stops and targets" section, add a stop loss and in the filed "From entry signal" enter Long1. Next, add the trailing stop and in its "from entry signal" type Long2. Now the exits are tied to the entries.

          What is important is that you use the exact same spelling and capitalization.

          In general, for using stops I would suggest setting the stop mode to Ticks and specifying the number of ticks away from the entry for the stop/trailing stop.

          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by andrewtrades, Today, 04:57 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          5 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          7 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X