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

Trade Tracking

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

    Trade Tracking

    I was wondering if there is a way to get information from NT8 to track trades. I want to create an indicator for myself to track trades. i well export it to a cvs. I know how to export but not sure if I can get trade info.

    #2
    Hello ballboy11,

    You can loop through the orders in an account.

    Below is a publicly available link to the help guide.


    However, there is not a trade performance collection for account objects.

    Please let me know if you would like to submit a feature request for the NinjaTrader Development to consider adding a trade performance collection to account objects.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      i have been going through your NT8 manual but I am confused how to retrieve myEntryOrder.

      /* Example of subscribing/unsubscribing to order update events from an Add On. The concept can be carried over

      to any NinjaScript object you may be working on. */

      public class MyAddOnTab : NTTabPage

      {

      private Account account;

      private Order myEntryOrder;

      private Order profitTarget;

      private Order stopLoss;



      public MyAddOnTab()

      {

      // Find our Sim101 account

      lock (Account.All)

      account = Account.All.FirstOrDefault(a => a.Name == "Sim101");



      // Subscribe to order updates

      if (account != null)

      account.OrderUpdate += OnOrderUpdate;

      }



      // This method is fired as the status of an order changes

      private void OnOrderUpdate(object sender, OrderEventArgs e)

      {

      // Submit stop/target bracket orders

      if (myEntryOrder != null && myEntryOrder == e.Order)

      {

      if (e.OrderState == OrderState.Filled)

      {

      string oco = Guid.NewGuid().ToString("N");



      profitTarget = account.CreateOrder(e.Order.Instrument, OrderAction.Sell, OrderType.Limit, TimeInForce.Day,

      e.Quantity, e.AverageFillPrice + 10 * e.Order.Instrument.MasterInstrument.TickSize, 0, oco, "Profit Target", null);

      stopLoss = account.CreateOrder(e.Order.Instrument, OrderAction.Sell, OrderType.StopMarket, TimeInForce.Day,

      e.Quantity, 0, e.AverageFillPrice - 10 * e.Order.Instrument.MasterInstrument.TickSize, oco, "Stop Loss", null);

      account.Submit(new[] { profitTarget, stopLoss });

      }

      }

      }

      Comment


        #4
        Does OnOrderUpdate work for manual trades or is it just for a strategy?

        Comment


          #5
          Hello ballboy11,

          When using the Addon approach to find orders that are not submitted by the NinjaScript Strategy, you would need to loop through the orders collection from the account.

          If you are trying to detect new orders, you would need an event handler added to the <Account>.OrderUpdate event.

          Below is a public link to the help guide.



          OnOrderUpdate only triggers for orders submitted from the NinjaScript Strategy that this is being checked from. Manual orders and orders submitted from outside of the strategy will not affect the strategy position, orders, or performance.


          From your initial description, it sounds as if you would like all orders to an account and not only the orders submitted from a NinjaScript strategy, is this not the case?

          If you are looking for the Strategy performance of a NinjaScript Strategy this can be found with SystemPerformance.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            actually I am looking for tracking manual orders NOT strategy orders

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Barry Milan, Yesterday, 10:35 PM
            5 responses
            16 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by DanielSanMartin, Yesterday, 02:37 PM
            2 responses
            13 views
            0 likes
            Last Post DanielSanMartin  
            Started by DJ888, 04-16-2024, 06:09 PM
            4 responses
            12 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by terofs, Today, 04:18 PM
            0 responses
            11 views
            0 likes
            Last Post terofs
            by terofs
             
            Started by nandhumca, Today, 03:41 PM
            0 responses
            8 views
            0 likes
            Last Post nandhumca  
            Working...
            X