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 judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          59 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          36 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          7 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          21 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          10 views
          0 likes
          Last Post cre8able  
          Working...
          X