Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Getting expiry of Contract

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

    Getting expiry of Contract

    How can I access the expiry information of a contact that is not the primary contract in a multi series script. For the primary contract I am using Instrument.Expiry.Month.
    Last edited by GKonheiser; 01-09-2014, 03:08 AM.

    #2
    GKonheiser, nothing truly supported via NinjaScript in that area, however would try looking into Instruments[1].Expiry.Month
    BertrandNinjaTrader Customer Service

    Comment


      #3
      would that be the same for Position

      ie if I have a added FGBL with index location 3, can I use Position[3].MarketPosition == MarketPosition.Flat?

      Comment


        #4
        Correct, that would provided access to the Positons array for your script - this is also fully documented with an example here in our helpguide - http://www.ninjatrader.com/support/h.../positions.htm
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi Bertrand,

          Thanks for your help on this this morning.

          Is there anything I need to take into account when writing the OnOrderUpdate for the second contract

          ie if (order.OrderState == OrderState.Cancelled && order.Filled == 0),

          will there be any confusion with the primary contracts orders, ie what if both contracts get a fill at the same time?

          Same for OnExecution when checking for executions what if there are two fills at the same time, what happens to execution.Order.OrderState ?
          Last edited by GKonheiser; 01-09-2014, 07:40 AM.

          Comment


            #6
            That would be dependent upon which IOrder object you set your OnOrderUpdate code to listen to, its per default called for all.

            i.e. if (entryOrder != null && entryOrder == order) with this check you would only apply the following logic / check then for the entryOrder object.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              OK, Sorry for my ignorance, but if I have a multi series script and I get two fills at the same time for two different contracts say two iOrders, longBund and longBobl , and I do a check for longBund == execution.order and longBobl == execution.order would they both come back as true, ie can execution.order be for more then one order?? does that make sense?

              Comment


                #8
                Both executions would trigger OnExecution() in your example, where you designate what code to run if execution.order's calling is tied to IOrder A or your IOrder B.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by FishTrade, Yesterday, 11:11 PM
                3 responses
                10 views
                0 likes
                Last Post FishTrade  
                Started by Graci117, Today, 09:02 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by ETFVoyageur, Today, 07:55 PM
                0 responses
                8 views
                0 likes
                Last Post ETFVoyageur  
                Started by janio973, Today, 07:24 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by aligator, 01-06-2022, 12:14 PM
                4 responses
                248 views
                0 likes
                Last Post john_44573  
                Working...
                X