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 Jonafare, 12-06-2012, 03:48 PM
        5 responses
        3,984 views
        0 likes
        Last Post rene69851  
        Started by Fitspressorest, Today, 01:38 PM
        0 responses
        2 views
        0 likes
        Last Post Fitspressorest  
        Started by Jonker, Today, 01:19 PM
        0 responses
        2 views
        0 likes
        Last Post Jonker
        by Jonker
         
        Started by futtrader, Today, 01:16 PM
        0 responses
        7 views
        0 likes
        Last Post futtrader  
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,791 views
        0 likes
        Last Post aligator  
        Working...
        X