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

Plot Executions on ES Chart while Trading MES

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

    Plot Executions on ES Chart while Trading MES

    I am trying to create something to Plot MES Trades on an ES Chart. Basically duplicating the DataSeries | Trades | Text and marker setting. Since these are different Instruments the ES Chart will not recognize the MES trades.

    Looking for a pointer on which direction I should take: Indicator Script, Addon, or wait for NT to make that feature available (Hint)? Obviously I will have to create my on position update tracking which I think I can do. I am looking for direction on what will work on a chart. I don't need an Addon Window as I want the markers in the ES Chart.

    Any help, code snippets or suggestion would be greatly appreciated.




    PS: the Account Link in Ninjascript | Language Reference | Addon may have an issue. Does not work on my computer.


    #2
    Hi TAJTrades,

    Thanks for your post.

    An indicator will suffice for this. See this help guide example on adding an account object to your script https://ninjatrader.com/support/help...ount_class.htm

    You can follow that example and set up an account object in your indicator. You can then use the Executions collection within the Account class to loop through and draw the executions of MES on your ES chart.

    All the best regards!
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      I am using an ATM with just a Target and a Stop for trade management.

      Using OnExecutionUpdate from the Account Class as suggested and also Using OnOrderUpdate I can get all current trades to print correctly to the OutputWindow.
      I can also Draw.Ray for the Open Position Entry, Target and Stop.

      However when the Stop or Target is hit I am trying to Draw.Line from the Trade Open to the Trade Close and everything craps out. No post in the Control Center | Log or anything to the OutputWindow. Why would Draw.Ray work but not Draw.Line not? I have printed all the Line values (prices, start bars ago.....) and they are correct.

      Any suggestion. I can post code here or email it that would help.

      Comment


        #4
        Hi TAJTrades, thanks for your patience.

        I would recommend using Draw.Line rather than a Ray. With a Line, you can define both start and end points.

        See here for the documentation on Draw.Line:


        Please let me know if you have any questions on that.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Has anyone made an exmaple indicator for this?
          Unsuitable
          NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

          Comment


            #6
            Hi Unsuitable,

            Unfortunately, I do not know of an existing example. I should have mentioned when the post was made, but it is not supported to retrieve historical executions from the database. A script that does this would need to capture each trade made on the historical data and save the executions to a custom data structure. Using that data structure you could then draw lines corresponding to the trades.

            Kind regards,
            -ChrisL
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Hello ChrisL,

              I'm going to give it a go at making it. For example, charting is done on the ES, but trades are executed on a hidden MES overlay. Both data series will exist within the same chart so that's how the data will be collected. For plotting the chart markers, either it will be done on a button press, on bar update, or on a new bar. To avoid re-drawing the same chart marker over and over, the indicator will have a collection of chart markers plotted and check if it hasn't been added yet. Although going through a list isn't super efficient, perhaps it holds only the last chart marker and it assumes the previous ones are drawn already.

              Anyways, got a rough idea of how to code it up. Gotta see if it's possible.

              Thanks
              Unsuitable
              NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

              Comment


                #8
                Well, the indicator is finished. Still unable to get historical data, only current session data. Once the limitation is fixed, I'll be able to push an update.

                Can check it out here
                Unsuitable
                NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by trilliantrader, 04-18-2024, 08:16 AM
                4 responses
                18 views
                0 likes
                Last Post trilliantrader  
                Started by mgco4you, Today, 09:46 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by wzgy0920, Today, 09:53 PM
                0 responses
                9 views
                0 likes
                Last Post wzgy0920  
                Started by Rapine Heihei, Today, 08:19 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by Rapine Heihei, Today, 08:25 PM
                0 responses
                10 views
                0 likes
                Last Post Rapine Heihei  
                Working...
                X