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 jaybedreamin, Today, 05:56 PM
    0 responses
    3 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    1 view
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    6 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Working...
    X