Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help With Strategy Script writing

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

    Help With Strategy Script writing

    I am new to Ninja - but writing some code .
    Question 1 - is there a full reference for the language
    like what are the options on say execution.order.________
    etc..

    Question 2. I am having a stratgey with different entries at same time say Long #1 when trigger A and can still be long and have a different trigger say B for Long # 2
    How do I find my (AvgfillPrice) or fill price for Long 1 and Fill price for Long # 2


    Also though this I believe I saw already - How do I get the Current Bar Close price ?

    #2
    Hello hhalamish,

    Thank you for your post and welcome to the NinjaTrader support forum!

    1. Execution.Order references the IOrder object properties. You can find these at the following link: http://www.ninjatrader.com/support/h...nt7/iorder.htm

    2. Use the link above to understand IOrder objects and create one for each entry, then use AvgFillPrice to pull the individual fill price. Please see below for an example:
    Code:
            #region Variables		
            private IOrder myentry1 = null;
    		private IOrder myentry2 = null;
            #endregion
    
            
            protected override void Initialize()
            {
               	
            }
    		
    		protected override void OnBarUpdate()
    		{
    			myentry1 = EnterLong(1, "myentry1");
    			myentry2 = EnterLong(1, "myentry2");
    		}
    		
    		protected override void OnOrderUpdate(IOrder order)
    		{
    			if(myentry1 != null && myentry1 == order)
    			{
    				if(order.OrderState == OrderState.Filled)
    				{
    					Print(order.AvgFillPrice);
    					myentry1 = null;
    				}
    			}
    			if(myentry2 != null && myentry2 == order)
    			{
    				if(order.OrderState == OrderState.Filled)
    				{
    					Print(order.AvgFillPrice);
    					myentry2 = null;
    				}
    			}
    		}
    For information on OnOrderUpdate() please visit the following link: http://www.ninjatrader.com/support/h...rderupdate.htm

    The current bar's close price is accessed with Close[0], please visit the following link for information on Close: http://www.ninjatrader.com/support/h.../nt7/close.htm

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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    114 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    61 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    40 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    43 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    82 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X