Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

unique entries

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

    unique entries

    I have 2 unique entries "Buy_1" and "Buy_2". I would like to use as part of a condition for the Buy_2 entry "If Buy_1 is long" then do something. How can
    Position.MarketPosition == MarketPosition.Long;
    include the distinction of a unique entry?
    Thanks

    #2
    Hello kenb2004,
    Thanks for writing in and I am happy to assist you.
    Unfortunately Position class will return the total position of the instrument and not by individual order.
    As an alternative you can assign an IOrder to the individual orders and can check the state of the order. Like:
    in variable
    Code:
    private IOrder buy_1 = null;
    in OnBarUpdate
    Code:
    		
    buy_1 = EnterLong("buy_1");
    			
    if (buy_1.OrderState == OrderState.Filled)
    {
    	//do something
    }


    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      How long do the order.state's last? Do they persist until another order.state is reached? I am using IOrders and using the code from the SampleCancelOrder Strategy and as soon the state is filled or partially filled or cancelled, the Order.State is changed to null. So the condition needs to be if MarketPosition is long and the order is Buy_1.

      Comment


        #4
        Hello kenb2004,
        The order object will last as long as you want it to. If you nullify the object then the objects information will be lost. All depends on what and how you want to do things.

        In case of the SampleCancelOrder the order is nullified once the order gets cancelled/part-filled.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ageeholdings, Today, 07:43 AM
        0 responses
        7 views
        0 likes
        Last Post ageeholdings  
        Started by pibrew, Today, 06:37 AM
        0 responses
        4 views
        0 likes
        Last Post pibrew
        by pibrew
         
        Started by rbeckmann05, Yesterday, 06:48 PM
        1 response
        14 views
        0 likes
        Last Post bltdavid  
        Started by llanqui, Today, 03:53 AM
        0 responses
        6 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        12 views
        0 likes
        Last Post burtoninlondon  
        Working...
        X