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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    72 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    39 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X