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 jeronymite, 04-12-2024, 04:26 PM
          3 responses
          40 views
          0 likes
          Last Post jeronymite  
          Started by bill2023, Today, 08:51 AM
          2 responses
          15 views
          0 likes
          Last Post bill2023  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          167 responses
          2,260 views
          0 likes
          Last Post jeronymite  
          Started by warreng86, 11-10-2020, 02:04 PM
          7 responses
          1,362 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by Perr0Grande, Today, 08:16 PM
          0 responses
          5 views
          0 likes
          Last Post Perr0Grande  
          Working...
          X