Get executions trades from the indicator. - NinjaTrader Programming | futures io social day trading
futures io futures trading


Get executions trades from the indicator.
Updated: Views / Replies:1,776 / 21
Created: by Sevas Attachments:9

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 9  
 
Thread Tools Search this Thread
 

Get executions trades from the indicator.

  #1 (permalink)
Trading Apprentice
Russia Ptz
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 2 since Apr 2015
Thanks: 1 given, 0 received

Get executions trades from the indicator.

Hello,

Can't deal with how to get executions trades from the indicator. I can take them from db?

Thank you.


Last edited by Sevas; April 24th, 2015 at 09:48 AM.
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received



Sevas View Post
Hello,

Can't deal with how to get executions trades from the indicator. I can take them from db?

Thank you.

Try getting the right account from the following collection (you will need "using NinjaTrader.Cbi;"):
 
Code
NinjaTrader.Cbi.Globals.Accounts
You should be able to identify the right one by the name

Once you have the "account" you can search in

 
Code
account.Positions
or
 
Code
account.Orders
or
 
Code
account.Executions
collections depending on what you want to achieve

Reply With Quote
The following user says Thank You to gregid for this post:
 
  #4 (permalink)
Elite Member
Phoenix, Arizona
 
Futures Experience: Advanced
Platform: Ninja Trader
Favorite Futures: Oil
 
Posts: 52 since Jul 2009
Thanks: 1 given, 6 received


gregid View Post
Try getting the right account from the following collection (you will need "using NinjaTrader.Cbi;"):
 
Code
NinjaTrader.Cbi.Globals.Accounts
You should be able to identify the right one by the name

Once you have the "account" you can search in

 
Code
account.Positions
or
 
Code
account.Orders
or
 
Code
account.Executions
collections depending on what you want to achieve

Once you have the collection, how do you extract information like the instrument traded, the position either long or short and the number of contracts? I have very little experience with collections.

thanks,
taddypole...

Reply With Quote
 
  #5 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,860 since Jun 2009
Thanks: 480 given, 3,255 received


Taddypole View Post
Once you have the collection, how do you extract information like the instrument traded, the position either long or short and the number of contracts? I have very little experience with collections.

thanks,
taddypole...

For more info see this and this
 
Code
Print("Instrument = " + Instrument.MasterInstrument.Name);
Print("Am I long, short or flat? " + Position.MarketPosition.ToString());
Print("How many contracts am I holding? " + Position.Quantity);

Reply With Quote
The following user says Thank You to shodson for this post:
 
  #6 (permalink)
Elite Member
Phoenix, Arizona
 
Futures Experience: Advanced
Platform: Ninja Trader
Favorite Futures: Oil
 
Posts: 52 since Jul 2009
Thanks: 1 given, 6 received

Thank you Shodson, that helped a lot.

Can you also show me where to find on the MSDN site references to the Collections used by NinjaTrader? There are several and I'm really not sure which one to focus on.


Also, in the attached figure, can you tell me how to find only the most recent entry for a specific instrument?

I really appreciate your help.

regards,
taddypole....

Attached Thumbnails
Get executions trades from the indicator.-executioncollection.jpg  
Reply With Quote
 
  #7 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,860 since Jun 2009
Thanks: 480 given, 3,255 received


Taddypole View Post
Thank you Shodson, that helped a lot.

Can you also show me where to find on the MSDN site references to the Collections used by NinjaTrader? There are several and I'm really not sure which one to focus on.


Also, in the attached figure, can you tell me how to find only the most recent entry for a specific instrument?

I really appreciate your help.

regards,
taddypole....

The collections used by Ninjatrader are created by Ninjatrader, so you won't find them on the MSDN site. I don't know any central place that lists all of Ninjatraders collections. You just need to spend a lot of time in the "Ninjascript" section of the NT7 help guide.

NinjaTrader Version 7

As for finding the most recent execution, sorry, but you will probably have to use a foreach statement. The other possibility is a LINQ query but that's more complicated to explain how to do. I've never had a need to do what you are trying to do so I can't tell you off the top of my head but I could probably figure it out.

Reply With Quote
 
  #8 (permalink)
Elite Member
Monterrey, Mexico
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: Treasuries
 
aquarius's Avatar
 
Posts: 22 since Nov 2012
Thanks: 5 given, 69 received

Using events

You could also try listening to events being triggered:

 
Code
var accounts = NinjaTrader.Cbi.Globals.Accounts;
account = accounts.FindByName("Your account name");

account.PositionUpdate += account_PositionUpdate;
account.OrderStatus += account_OrderStatus;
account.Execution += account_Execution;
the execution event handler would look like:

 
Code
        private void account_Execution(object sender, NinjaTrader.Cbi.ExecutionUpdateEventArgs e)
        {
            Print(string.Format("Account_Execution event: Time: {0}, ExecutionId: {1}, Exchange: {2}, AccountName: {3}, OrderId: {4}, Instrument: {5}, Price: {6}, Quantity: {7}, MarketPosition: {8}, Operation: {9}, Rate: {10}, Sod: {11}, Multiplier: {12}, Error: {13}, NativeError: {14}", e.Time, e.ExecutionId, e.Exchange, e.Account.Name, e.OrderId, e.Instrument.FullName, e.Price, e.Quantity, e.MarketPosition, e.Operation, e.Rate, e.Sod, e.Multiplier, e.Error, e.NativeError));
        }
The account_Execution method will always have the latest event (execution) triggered.

Hope this helps

Reply With Quote
The following user says Thank You to aquarius for this post:
 
  #9 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,860 since Jun 2009
Thanks: 480 given, 3,255 received

Yeah, and you could keep track of the last trade as the event is fired with a class-level variable so you wouldn't have to search or foreach through any collections to find the last execution.

Reply With Quote
 
  #10 (permalink)
Elite Member
Phoenix, Arizona
 
Futures Experience: Advanced
Platform: Ninja Trader
Favorite Futures: Oil
 
Posts: 52 since Jul 2009
Thanks: 1 given, 6 received


thanks guys, I really appreciate this help.

Unfortunately I'm not a programmer and have some compile errors. I have some questions.

1. In which section of code do I put this new code?
2. Can you help me with the compile errors in the attachment?

thanks,
taddypole....

Attached Thumbnails
Get executions trades from the indicator.-complieerrors.jpg  
Reply With Quote

Reply



futures io > > > > > Get executions trades from the indicator.

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Import Executions into NT7 Fadi NinjaTrader 6 January 14th, 2017 03:18 PM
Proper Sequence of Executions arashf EasyLanguage Programming 4 September 25th, 2014 12:35 AM
Input executions into NinjaTrader Camdo NinjaTrader 3 May 4th, 2014 06:48 PM
All days executions alexbbfg NinjaTrader Programming 1 January 18th, 2014 12:45 PM
Why do executions appear to be diff related to bars after NT restart DabaDave Traders Hideout 2 June 15th, 2010 03:26 PM


All times are GMT -4. The time now is 09:06 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-18 in 0.15 seconds with 20 queries on phoenix via your IP 107.20.115.174