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 Aviram Y, Today, 05:29 AM
      4 responses
      11 views
      0 likes
      Last Post Aviram Y  
      Started by algospoke, 04-17-2024, 06:40 PM
      3 responses
      26 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by bmartz, 03-12-2024, 06:12 AM
      3 responses
      30 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Started by gentlebenthebear, Today, 01:30 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by cls71, Today, 04:45 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X