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

Entering Trades When Price Away from Key Areas of Support & Resistance

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

    Entering Trades When Price Away from Key Areas of Support & Resistance

    Hi....
    Pls bear with me on this one, whilst I try & explain what I am attempting to do.
    I have a simple JMA strategy which enters a trade when 2x different JMAs cross & also when there is a continuation after a pullback.

    What I would like to do is limit trade entry to when the price is not close to a key area of support & reistance. i.e.

    if (Close[0] + 10 < AreaOfSupport && AreaOfSupport + 10 < Close[0])
    then EnterLong().

    I have now established indicators (which are basically a number of constant lines with a specific price value associated to each) which can be used for the above purpose.

    However, the number of lines I am talking about is > 20 & I was thinking there must be two coding options to execute this:

    1/ As above, but repeat that line of code for the different AreasOfSupport & AreasOfResistance ---- laborious.

    or.....

    2/ If (Close[0] - 10 < AreaOfSupport 1,2,3,4,5,6,7,8, etc && AreaOfSupport 1,2,3,4,5,6,7,8, etc. + 10 < Close[0]
    then EnterLong() ---- quicker to code.

    Since I have a number of different entry & exit conditions for both long & short then samples '1' or '2' have to be repeated for each of the conditions, hence the preference for Option '2' if this is possible.

    Question to NT -> Is option '2' possible to code?
    Many thx in advance

    David

    #2
    Is each set of support resistance lines a pair and they may overlap? Or are all of the support lines lower than all of the resistance lines (i.e. you really only need to check the hghest support and lowest resistance)?

    Comment


      #3
      Pete
      They are all unique no-trade-horizontal-price-bands. Some may overlap, but that would just widen that specific no-trade-horizontal-price-band.
      hope that makes sense. some are pivots, some are fibs, some are market profile numbers, etc. etc.

      thx
      David

      Comment


        #4
        If you only want one if statement then you will need to make a long string of conditions through the use of the OR operator.

        if (blah blah || blah blah 2 || blah blah 3 || blah balh4)
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          thx Josh - that sounds logical. I think I can code around that.
          DG

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by michi08, 10-05-2018, 09:31 AM
          5 responses
          741 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by The_Sec, Today, 02:29 PM
          0 responses
          2 views
          0 likes
          Last Post The_Sec
          by The_Sec
           
          Started by tsantospinto, 04-12-2024, 07:04 PM
          4 responses
          62 views
          0 likes
          Last Post aligator  
          Started by sightcareclickhere, Today, 01:55 PM
          0 responses
          1 view
          0 likes
          Last Post sightcareclickhere  
          Started by Mindset, 05-06-2023, 09:03 PM
          9 responses
          261 views
          0 likes
          Last Post ender_wiggum  
          Working...
          X