Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sending MES orders from ES trading

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

    Sending MES orders from ES trading

    Hi

    I am trying to set up an Addon that would trigger trades to a different account account with a different instrument.

    Let me try to explain my goal here.

    I want to trade ES from SIM1 account that would trigger same MES trade levels but different size to a SIM Apex 100000 account.

    When I try to do it it takes the trade but I get the attached error message.







    Attached Files

    #2
    Hello blar58,

    Thank you for writing in.

    Is this an Add-on that you developed yourself, or was it imported from a third party?

    The error message you are receiving usually means one of two things:
    • The connection is not enabled for real-time data for the instrument being traded
    • The order is being placed to an expired contract
    ​Do you receive any additional errors in the Log tab of the Control Center? If so, what do these errors report?

    I look forward to your reply.

    Comment


      #3
      Hi Emily

      Yes this is an Addon developped by me.
      The connection is enabled for real time data
      The order being placed is for MES DEC 2022 contract as I have printed the instrument full name and expiry in my output window.

      I did not receive any additional errors in the Log Tab

      Comment


        #4
        Emily

        I have looked at the trace file and I see this as my instrument for the order submitted ::

        instrument='ES 12-22'

        instrument='MES'


        It seems that MES is not showing expiry.

        Here is the code I use to get MES instrument from my Addon :

        Code:
        Instrument intrumentTotrade = Cbi.Instrument.GetInstrument("MES");
        intrumentTotrade.Expiry = Instrument.Expiry;​
        
        
        if(e.Order.OrderAction == OrderAction.Buy)
        copierOrder = copierAccount.CreateOrder(intrumentTotrade, OrderAction.Buy, OrderType.Limit, TimeInForce.Day, (int)(e.Quantity*fa.Ratio), e.Order.LimitPrice, 0, e.Order.Oco, e.Order.Name, null);
        else
        copierOrder = copierAccount.CreateOrder(intrumentTotrade, OrderAction.BuyToCover, OrderType.Limit, TimeInForce.Day, (int)(e.Quantity*fa.Ratio), e.Order.LimitPrice, 0, "", e.Order.Name, null);
        
        copierAccount.Submit(new[] { copierOrder });
        AssociatedOrder.Add(copierAccount.Name+" "+e.OrderId, copierOrder);
        NinjaTrader.Code.Output.Process(" Main Instrument "+Instrument.FullName+" "+Instrument.Expiry+" New Instrument "+intrumentTotrade.FullName+" "+intrumentTotrade.Expiry, PrintTo.OutputTab1);​

        My output window is showing this :
        Main Instrument ES 12-22 2022-12-01 12:00:00 AM New Instrument MES 2022-12-01 12:00:00 AM

        Comment


          #5
          Hello blar58,

          Thank you for your reply.

          I suspect that you will need to include the expiry with the full name of the instrument for the instrumentName parameter in GetInstrument()



          This would mean that the first line you shared should reflect Instrument.GetInstrument("MES 12-22"); and then the second line could be removed/commented out.

          Please let us know if we may be of further assistance.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          648 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X