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

Where from does NT7 get data to plot executions markers on a chart?

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

    Where from does NT7 get data to plot executions markers on a chart?

    Hello Support and others --

    Could you please tell me where from NT7 gets data to plot executions markers on a chart? I\d like to use them for my script.

    Thank you in advance.

    #2
    Thanks for the post Alex, there would not be anything native in NinjaScript for this access however you might want to check into this script found in our sharing for potential ideas - http://www.ninjatrader.com/support/f...d=6&linkid=533
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand,

      thank you for your reply. I need the access to the past executions. NT7 does it when plot executions and displays performance data. I just want to use NT7's methods and do not invent a bycicle.

      Regards.

      Comment


        #4
        Alex, then I would suggest to look into the Account.Executions collection.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Bertrand,

          thank you for your suggestion. I made the following code based on your advice

          foreach (Account acct in Cbi.Globals.Accounts)
          {

          if (acct.Executions != null)
          {
          ExecutionCollection execution = acct.Executions;
          foreach (Execution eX in execution)
          {
          Print(eX.Account + " " + eX.Instrument + " " + eX.Price + " " + eX.Quantity + " " + eX.Exchange);
          }
          }
          }

          But it gives nothing. What could be wrong?

          Thank you in advance.

          Comment


            #6
            You likely do not not have any executions on the account since the last account update.

            This is a collection of real-time executions - you should test by running the script on the Sim101 account, and while the script is running, place a market order and you should see a recent execution in the collection appear.

            You should considering debugging the foreach loop on Cbi.Global.Accounts to ensure this is even being called.
            MatthewNinjaTrader Product Management

            Comment


              #7
              Matthew,

              I put Print() method inside of each part of the code

              foreach (Account acct in Cbi.Globals.Accounts)
              {

              Print("foreach (Account acct in Cbi.Globals.Accounts) -> works");

              if (acct.Executions != null)
              {

              Print("if (acct.Executions != null) -> works");

              ExecutionCollection execution = acct.Executions;
              foreach (Execution eX in execution)
              {

              Print("foreach (Execution eX in execution) -> works");

              Print(eX.Account + " " + eX.Instrument + " " + eX.Price + " " + eX.Quantity + " " + eX.Exchange);
              }
              }
              }

              and it prints "foreach (Account acct in Cbi.Globals.Accounts) -> works" and Print("if (acct.Executions != null) -> works"); but "foreach (Execution eX in execution) -> works" does not. It means that the script sees the account, sees the execution collection which is not empty but does not see execution in the collection.

              How can it be?

              My aim to get not only current session trades but the past days either.

              Please, help.

              Thank you in advance.

              Comment


                #8
                Executions will only be collected for the current session. I'm not aware of a way to obtain the previous executions in your database.

                Can you verify on the Executions tab that you can obtain the information displayed for the current session? If so, this would be working as expected.
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  Execution tab does not have the option to select the period of executions, but Account Performance does. And the Execution tab inside Account Performance tab has the option of period selection either. Nevertheless, the code does not work as expected.

                  Regards.

                  Comment


                    #10
                    Originally posted by alex_bbfg View Post
                    Execution tab does not have the option to select the period of executions
                    Correct, the Executions tab is only for the current session and this would be the collection you're looping through.

                    For historical executions, these are stored and contained in your database file, which accessing is far beyond what we designed or can support in this version.
                    MatthewNinjaTrader Product Management

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Rapine Heihei, Today, 08:19 PM
                    1 response
                    3 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by Rapine Heihei, Today, 08:25 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post Rapine Heihei  
                    Started by f.saeidi, Today, 08:01 PM
                    1 response
                    4 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by Rapine Heihei, Today, 07:51 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post Rapine Heihei  
                    Started by frslvr, 04-11-2024, 07:26 AM
                    5 responses
                    96 views
                    1 like
                    Last Post caryc123  
                    Working...
                    X