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

Avoiding Buy triggers near resistance

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

    Avoiding Buy triggers near resistance

    I was trying to come up with a way to create a strategy so that buys are avoided near strong resistance areas. Im noticing that is a weakness in my strategy. Its seems this would be difficult to do. Was thinking to have the program automatically create resistance lines based on certain criteria and have it avoid purchases within a certain distance of the resistance line. Anyone have any pointers for acheiving this or has successfully created a method for this type of strategy?

    #2
    zachj, I would not be aware of a full example strategy for this type of filtering already available, but generally as idea you could structure it like the below : this would take the daily Pivot point as sup / res value and have a no trade entry zone around it of 4 ticks...

    Code:
    		protected override void OnBarUpdate()
    		{
    			if (CrossAbove(SMA(Fast), SMA(Slow), 1) && PivotEntry())
    			    EnterLong();
    			else if (CrossBelow(SMA(Fast), SMA(Slow), 1) && PivotEntry())
    			    EnterShort();
    		}
    		
    		private bool PivotEntry()
    		{
    			double pivot = Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 1).PP[0];
        		
    			if (Close[0] > pivot + 4 * TickSize || Close[0] < pivot - 4 * TickSize) 
    				return true;
    			
    			else return false;
    		}
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Ok thanks. I was reading about the Pivot command in the guide but I don't see how exactly the Pivot point is calculated, does it take the average price over a certain period or something to that effect?

      I assume you can have it print the resistance line with a print command somehow?

      Comment


        #4
        zachj,
        Can see this post for details on how pivots are caluclated. Yes, can print or chart the built in pivots indicator to check its values.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ETFVoyageur, Today, 10:34 AM
        8 responses
        20 views
        0 likes
        Last Post ETFVoyageur  
        Started by HiddenPhilosopher, 05-22-2020, 01:09 AM
        28 responses
        2,722 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by warpinator, 05-16-2024, 10:44 AM
        11 responses
        60 views
        0 likes
        Last Post ETFVoyageur  
        Started by KNalley, 01-24-2020, 10:33 AM
        10 responses
        965 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Skifree, Today, 11:47 AM
        3 responses
        13 views
        0 likes
        Last Post Skifree
        by Skifree
         
        Working...
        X