Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Auto Chase Parameters in Strategy

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

    Auto Chase Parameters in Strategy

    Hello I was searching for the auto chase parameters and couldn't find it in the help guide.

    What I'm trying to do is have this strategy execute with an auto chase if touched with a limit of 2. Is there any examples of how to code this or a regular auto chase in ninjascript.

    Here's the code im working with

    Position.MarketPosition = MarketPosition.Flat
    Close(1) < Open(1)

    EnterLongLimit(DefaultQuanity, Close(0) +-5 * Ticksize

    Any help on this would be appreciated

    Thanks

    #2
    Hello rdprioleau,

    Thank you for your post.

    There is no method for Auto Chase in NinjaScript. This would need to be manually created by checking the current price versus the last price, and if the price moved away from the Limit's price level then adjust as desired.

    An example would be:
    Code:
            #region Variables		
            private IOrder myLimit;
            #endregion
    
            
            protected override void Initialize()
            {
               	
            }
    		
    		protected override void OnBarUpdate()
    		{	
    			if(Close[1] < Open[1] && Position.MarketPosition == MarketPosition.Flat)
    			{
    				myLimit = EnterLongLimit(DefaultQuantity, Close[0]-5*TickSize);
    			}
    			
    			if(myLimit != null && Close[0] > myLimit.LimitPrice + 5*TickSize)
    				myLimit = EnterLongLimit(DefaultQuantity, Close[0]-5*TickSize);
    		}

    Comment


      #3
      Hello, this is a question for NinjaTrader_PatrickH.

      I am working on a similar strategy. I am trying to set an "AutoChase", but to close a position.


      When LONG, I want to have a Sell Limit Order 10 ticks above the lowest point the market has reached since my entry.

      When SHORT, I want to have a Buy Limit order 10 ticks below the highest point the market has reached since my entry.

      Of course these orders need to be dynamic (just like a trailing stop).

      How should I code this in the NinjaScript?


      Thanks!

      Comment


        #4
        Hello jmayerb,

        Thank you for your post and welcome to the NinjaTrader Support Forum!

        Below is an example using Min, Max and BarsSinceEntry. The entry is just a basic if close greater than open or close less than open.
        Code:
                protected override void OnBarUpdate()
                {
        			if(Position.MarketPosition == MarketPosition.Flat)
        			{
        				if(Close[0]>Open[0])
        					EnterLong();
        				else if(Close[0]<Open[0])
        					EnterShort();
        			}
        			
        			if(Position.MarketPosition == MarketPosition.Long)
        			{
        				ExitLongLimit(MIN(Low, BarsSinceEntry())[0]+(10*TickSize));
        			}
        				
        			if(Position.MarketPosition == MarketPosition.Short)
        			{
        				ExitShortLimit(MAX(High, BarsSinceEntry())[0]-(10*TickSize));
        			}
                }
        Please visit the following links for more information:
        Last edited by NinjaTrader_PatrickH; 12-16-2014, 10:32 AM.

        Comment


          #5
          Hello jmayerb,

          I have corrected my code in the preceding post.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          648 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X