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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    115 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    161 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    83 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    127 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    87 views
    0 likes
    Last Post PaulMohn  
    Working...
    X