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

Excluding trades based on price and indicator value

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

    Excluding trades based on price and indicator value

    I have a strategy I have created with the Strategy Builder and I'm looking to refine it, ideally without unlocking the code as I'm not proficient in that area. If needed, I might be able to do that but would prefer an option in Strategy Builder. To refine the strategy, I am looking to exclude trades if they are within a certain range of pivot points. Is there a way in Strategy Builder to exclude a trade say if it's near a pivot point, plus or minus 10 points in either direction? I can't figure out a way to do that. The offset functions seem limited in that capacity. Thanks in advance for the help!!

    #2
    Hello srtrader,

    Welcome to the NinjaTrader forums!

    Yes, the Pivots indicator does provide plots which can be selected from the Value plot drop-down. The Offset would apply to the selected plot value.

    Attached are a few screenshots of how this would look using the offset to draw a dot a few ticks above the S3 plot. For points you can use arithmetic and use whole numbers. This would also be the same in the condition builder when selecting the pivots indicator.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply! Can you elaborate a bit on this though? I'm still not sure how I would use this to refine my strategy. I'd like to be able to somehow plot that range and then exclude a trade within that range. For example, if all my criteria are met to trigger a trade, but the close of the bar is within the range of 10 points below S3 and 10 points above S3, the trade does not actually trigger. Is there a way to do that in Strategy Builder?

      Comment


        #4
        Hello srtrader,

        Your custom logic conditions can require the Close to be greater than, less than, or equal to the price of the pivot plots.

        Such as the price must be greater than the pivot plot with an offset of 10 to allow the condition that places an order to be true.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          So this is how I have it setup so far. I have my entry criteria in Set 1 of the Conditions and Actions. In that same screen I've created a group (PP Range). In this Condition Group I have it set to be greater than Pivot Point (offset 10) or less than Pivot Point offset -10). This seems to work fine, but my end goal is to do this same thing with all 7 pivot points. I don't think it would work to add everyone on the same Condition screen. I figured it would be easier and attainable to be able to create this range and then if price happens to be inside the range when a trade triggers, it doesn't allow the trade to actually trigger. I may be overthinking this but still can't seem to get this setup right.

          Attached Files

          Comment


            #6
            Hello srtrader,

            I'm not positive I'm following your logic, the MACD plots cross and the current price must be greater than pp plus 10 or less than pp minus 10 and greater than r1 plus 10 or less than r2 minus 10, etc with all 7 plots?

            You could have these in groups if the main trigger is the MACD cross..

            You could have a set of prices used as a range and require the price to be within those prices for the condition to be true.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              " the MACD plots cross and the current price must be greater than pp plus 10 or less than pp minus 10 and greater than r1 plus 10 or less than r2 minus 10, etc with all 7 plots?" => Yes that is what I'm trying to do. The trouble I'm having though is that if the price is greater than PP by 10 it meets that criteria but it could still be within the range of the next pivot point at R1. I can't use the "If All" condition because price can't be in both ranges at the same time. I also can't use the "If Any" function because it could be outside of the PP range but inside the R1 range. So instead of trying to create all of the criteria for a trade to trigger, is there a way to stop a trade from happening if it's within a range?

              Last edited by srtrader; 11-02-2021, 08:00 PM.

              Comment


                #8
                Actually I think I figured a way to do this. I just have to create a Set for each pivot point range (both for long and shorts). So I have 20 Sets in this one strategy. I think it works but not sure if there is an easier way to go about it.

                Comment


                  #9
                  Hello srtrader,

                  The only way to prevent an order, is to not call the order method to submit it.

                  Your conditions have to choose whether an order is submitted.

                  Separate condition sets may be necessary if this is not something that can be accomplished with group conditions.. The Strategy Builder is limited with the logic that can be created. With very complex logic it is sometimes necessary to unlock the script and code by hand. This is especially true if math is involved.

                  I'm happy you were able to work out a solution, my understanding of the conditions you want may be incomplete. From what you were describing it sounded like you wanted the price above and below all 7 of the pivot lines at the same time. I was thinking that would be a range of above the highest pivot and below the lowest pivot. Instead, is there another qualifier that would have a specific range of a specific pivot line?
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by geddyisodin, 04-25-2024, 05:20 AM
                  8 responses
                  60 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by jxs_xrj, 01-12-2020, 09:49 AM
                  4 responses
                  3,287 views
                  1 like
                  Last Post jgualdronc  
                  Started by Option Whisperer, Today, 09:55 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post Option Whisperer  
                  Started by halgo_boulder, 04-20-2024, 08:44 AM
                  2 responses
                  22 views
                  0 likes
                  Last Post halgo_boulder  
                  Started by mishhh, 05-25-2010, 08:54 AM
                  19 responses
                  6,189 views
                  0 likes
                  Last Post rene69851  
                  Working...
                  X