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

Get details of trades as they are placed

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

    Get details of trades as they are placed

    Hello,

    I want to track some averages during scalps, but I scale in and out whilst maintaining a position - Ninja does not give me accurate average prices, be, etc. for this. So, it is easy to calculate and I can write an indicator to simply put text with the number on the chart, but I need to know how to read trades as they are executed. I'm not interested in historical ones.

    I found out I could do this with ninja symbol positions, but I can of course only get the NT avg price, which is no good to me.

    So, my question is, how can I get data on the live trades places for my indicator? Is there any event called, etc, when a position is taken/closed? From what I can see, this might only be possible in a strategy and only on trades made by it.

    Can it be done?

    Thanks,

    #2
    Hello pjsmith,

    Thank you for writing in.

    It would be possible to obtain information about account executions with undocumented code.

    Here's an example:

    Code:
    foreach (Account acct in Cbi.Globals.Accounts)
    {
    	if (acct.Executions != null)
    	{
    		foreach (Execution execution in acct.Executions)
    		{
    			Print(execution.ToString());
    		}
    	}
    }
    In the sample code above, what the script will be doing is loop through each account, check if the account has any executions, and, if so, print out the execution.

    To obtain the price of an execution, use the Price property.

    Code:
    execution.Price
    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Thank you - I will give this a try and see if it gives me what I need. Thanks for the quick response.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by adeelshahzad, Today, 03:54 AM
      4 responses
      25 views
      0 likes
      Last Post adeelshahzad  
      Started by merzo, 06-25-2023, 02:19 AM
      10 responses
      823 views
      1 like
      Last Post NinjaTrader_ChristopherJ  
      Started by frankthearm, Today, 09:08 AM
      5 responses
      17 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      43 views
      0 likes
      Last Post jeronymite  
      Started by yertle, Today, 08:38 AM
      5 responses
      16 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X