Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Identifying which entry signal

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

    Identifying which entry signal

    Hey guys is there a way to identify which entry signal has an open position?

    For example for entry signal 1 Position.Quantity>0?

    I now have it set to

    EntryHandling = EntryHandling.UniqueEntries;

    #2
    Hello elitetradernyc,

    Thank you for your post.

    You would need to use IOrder objects for the entry and exit orders and call the FromEntrySignal and Quantity properties of the IOrder object for the exit. For example:
    Code:
            #region Variables		
            IOrder enter;
    		IOrder exit;
            #endregion
    
            
            protected override void Initialize()
            {
               	EntriesPerDirection = 1;
            }
    		
    		protected override void OnBarUpdate()
    		{
    			if(Historical)
    				return;
    			enter = EnterLong(2, "enter");
    			
    			if(exit != null)
    			{
    				Print("Entry " + exit.FromEntrySignal);
    				Print(" is long " + exit.Quantity);
    			}
    		}
    		protected override void OnOrderUpdate(IOrder order)
    		{
    			if(enter != null && enter == order)
    			{
    				if(order.OrderState == OrderState.Filled)
    				{
    					exit = ExitLongStop(Close[0] - 20 * TickSize, "exit", "enter");
    				}
    			}
    		}
    For information on IOrder objects please visit the following link: http://www.ninjatrader.com/support/h...nt7/iorder.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Hi Sir, I entered this code just as you suggested but for some reason on the instrument ES the stops do not always activate even though the price goes way below the stop level, can you help me determine why? Here is the code below exactly as it stands within my test strategy: I ran it on 1 tick betterrenko and 1 minute charts for 2013.

      #region Variables
      // Wizard generated variables
      IOrder enterLong1a;
      IOrder exitLong1a;

      protected override void Initialize()
      {
      CalculateOnBarClose = true;
      EntriesPerDirection = 1;
      }

      protected override void OnBarUpdate()
      {

      if(Bars.BarsSinceSession<2)
      {
      enterLong1a = EnterLong(2, "enterLong1a");
      }

      if(exitLong1a != null)
      {
      Print("Entry " + exitLong1a.FromEntrySignal);
      Print(" is long " + exitLong1a.Quantity);
      }
      }

      protected override void OnOrderUpdate(IOrder order)
      {
      if(enterLong1a != null && enterLong1a == order)
      {
      if(order.OrderState == OrderState.Filled)
      {
      exitLong1a = ExitLongStop(Close[0] - 2 * TickSize, "exitLong1a", "enterLong1a");
      }
      }
      }
      Last edited by elitetradernyc; 11-27-2013, 10:25 AM.

      Comment


        #4
        Hello elitetradernyc,

        Thank you for your response.

        You can use ExitLongStopLimit() to add a limit price to try and catch any break through the stop price. For example NinjaTrader ATM Strategies by default use a Stop Limit order with a 20 tick offset for the limit in order to try to catch any breaks past the stop level.

        For information on ExitLongStopLimit() please visit the following link: http://www.ninjatrader.com/support/h...gstoplimit.htm

        Please let me know if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X