• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 sohailashraf, Yesterday, 10:18 PM
      0 responses
      4 views
      0 likes
      Last Post sohailashraf  
      Started by jjnc2006, Yesterday, 07:36 PM
      0 responses
      11 views
      0 likes
      Last Post jjnc2006  
      Started by futurenick, Yesterday, 06:26 AM
      1 response
      12 views
      0 likes
      Last Post nkhoi
      by nkhoi
       
      Started by NinjaCustomer, Yesterday, 12:29 PM
      2 responses
      10 views
      0 likes
      Last Post NinjaCustomer  
      Started by Steve L, Yesterday, 11:32 AM
      0 responses
      9 views
      0 likes
      Last Post Steve L
      by Steve L
       
      Working...
      X