Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Strategy to monitor ALL account orders?
Updated November 14, 2014
Top Posters
looks_one
MXASJ
with 5 posts (2 thanks)
looks_two
Maza
with 3 posts (2 thanks)
looks_3
NinjaTrader
with 2 posts (0 thanks)
looks_4
SetFreeByTruth
with 2 posts (0 thanks)
trending_up
8,647 views
thumb_up
6 thanks given
group
8 followers
forum
18 posts
attach_file
1 attachments
Strategy to monitor ALL account orders?
March 31st, 2011, 10:29 AM
Asia
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800
traderwerks
What about something like zeromq in brokerless mode ? Also, there is the windows messaging framework, but I haven't kept up with that one.
Way, way OT but I'd love to find a way to turn this into the Poor Man's TIBCO
NetFPGA
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
March 31st, 2011, 03:23 PM
Minneapolis Minnesota
Posts: 5 since Mar 2011
Thanks Given: 2
Thanks Received: 0
MXASJ
Have a play with this:
Code
Print( "Total Open Positions: " + Account.Positions.Count);
System.Collections.IEnumerator ListPositions = Account.Positions.GetEnumerator();
for ( int i = 0 ; i < Account.Positions.Count; i++)
{
ListPositions.MoveNext();
Print( "Open Position: " + ListPositions.Current);
}
Please post back if you come up with something useful. I need to send position information to another computer and have not come up with an elegant way to do it yet.
Thank you! That is just what I was looking for. I also see I can use the Account.Orders collection to iterate over orders:
Code
int iOrderCount = Account.Orders.Count;
Print("Total Open Orders: " + iOrderCount );
System.Collections.IEnumerator ListOrders = Account.Orders.GetEnumerator();
for (int i = 0; i < iOrderCount; i++) {
ListOrders.MoveNext();
Print(" Open Orders: " + ListOrders.Current );
}
I wonder why the Account object isn't documented in the NT help file. Anyway, thank you!
April 2nd, 2011, 10:38 AM
San Antonio
Experience: Advanced
Platform: NinjaTrader Interactive Brokers
Broker: Interactive Brokers
Trading: forex
Posts: 45 since Oct 2010
Thanks Given: 0
Thanks Received: 116
I am attempting to trigger an ATM strategy from the SuperDom and then want to find it from a strategy (that is attached to a chart) and execute advanced trail logic that is not possible with an ATM. Specifically, I'm building a strategy that trails behind the 15m bar on a bar by bar basis . But it also, changes it's stop management 15 minutes before or after news. News is downloaded from Forex Factory via their xml interface live from within the strategy. The interface, which is a hidable side panel, will eventually list the news events and allow you to select which news to pay attention to and which to ignore.
I used the code in this thread to enumerate the Strategy collection, but it doesn't contain the strategy's UniqueID. I need the UniqueId to use AtmStrategyChangeStopTarget().
Here is the code I used:
Code
Print( "Total Strategies: " + Account . Strategies . Count ); System . Collections . IEnumerator ListStrategies = Account . Strategies . GetEnumerator (); for ( int i = 0 ; i < Account . Strategies . Count ; i ++) { ListStrategies . MoveNext (); Print( "Open Strategy: " + ListStrategies . Current ); }
I also tried this without success:
Code
foreach ( IStrategyData strat in StrategyData ) { //do something }
One option is to put buttons on my panel to create the entry and ATM from within the strategy. Then I would know the UniqueID, but this reduces flexability to add the trailing stop after the entry is made.
Any ideas?
April 2nd, 2011, 06:42 PM
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
@richtobey , an option is maybe to look in the NT database directly, the ID might be there.
I'm writing something like your 2nd option: a strategy with some buttons on an other panel, but without using ATM . That's very flexible.
Success requires no deodorant! (Sun Tzu)
November 13th, 2014, 04:27 PM
Cluj-Napoca Cluj/Romania
Experience: Intermediate
Platform: NinjaTrader, MetaTrader 4
Broker: FXCM, Continuum
Trading: Forex, Futures
Posts: 12 since Apr 2013
Thanks Given: 6
Thanks Received: 7
G'day guys,
I know I am resurrecting a dead horse here but none the less I need some help in tweaking this idea further.
I have followed and implemented the following code:
Code
int ioCount = account.Orders.Count;
System.Collections.IEnumerator ListOrders = account.Orders.GetEnumerator();
for (int i = 0; i < ioCount; i++) {
ListOrders.MoveNext();
Print(" Open Orders: " + ListOrders.Current);
}
Do you guys know of a method or a way to call to each individual order properties (like price) so I can use it in code further.
Thanks in advance,
Maza.
November 14th, 2014, 03:23 AM
Birmingham UK
Market Wizard
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,426
Maza
G'day guys,
I know I am resurrecting a dead horse here but none the less I need some help in tweaking this idea further.
I have followed and implemented the following code:
Code
int ioCount = account.Orders.Count;
System.Collections.IEnumerator ListOrders = account.Orders.GetEnumerator();
for (int i = 0; i < ioCount; i++) {
ListOrders.MoveNext();
Print(" Open Orders: " + ListOrders.Current);
}
Do you guys know of a method or a way to call to each individual order properties (like price) so I can use it in code further.
Thanks in advance,
Maza.
You can just use the Orders directly, e.g.
Code
Order myOrder = account.Orders[i];
Print(myOrder.OrderType);
November 14th, 2014, 06:07 AM
Cluj-Napoca Cluj/Romania
Experience: Intermediate
Platform: NinjaTrader, MetaTrader 4
Broker: FXCM, Continuum
Trading: Forex, Futures
Posts: 12 since Apr 2013
Thanks Given: 6
Thanks Received: 7
ratfink
You can just use the Orders directly, e.g.
Code
Order myOrder = account.Orders[i];
Print(myOrder.OrderType);
Firstly I would like to thank you ratfink for your timely answer.
I still have one more question that I can't find the answer to. How can I see (from code) what account is selected in the chart trader?
Thanks again,
Maza.
November 14th, 2014, 06:32 AM
Birmingham UK
Market Wizard
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,426
Maza
Firstly I would like to thank you ratfink for your timely answer.
I still have one more question that I can't find the answer to. How can I see (from code) what account is selected in the chart trader?
Thanks again,
Maza.
Code
private void accountChanged (object sender, EventArgs e)
{
if (ChartControl != null)
{
if (ChartControl.ChartTraderEnabled && ChartControl.ChartTraderVisible)
{
acDbg("accountChanged, ChartTrader is enabled and visible");
try
{
ctrAccount = (ComboBox)ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"];
acDbg("ctrAccount " + ctrAccount);
if (ctrAccount != null)
{
ctrSelectedAccount = (Account) ctrAccount.SelectedItem;
acDbg("ctrSelectedAccount " + ctrSelectedAccount);
if (ctrSelectedAccount != null)
{
mySelectedAccount = ctrSelectedAccount.Name.ToString();
acDbg("mySelectedAccount " + mySelectedAccount);
if (mySelectedAccount != "")
{
acDbg("accountName was " + accountName + " and now " + mySelectedAccount);
accountName = mySelectedAccount; // override ChartMinder Executions account
connectMyAccount("ChartTrader");
}
}
}
}
catch { acDbg("failed getting a/c change"); }
acDbg("out accountChanged");
}
}
}
private void attachToChartTrader ()
{
acDbg("attachToChartTrader CC " + ChartControl);
if (ChartControl != null)
{
if (ChartControl.ChartTraderEnabled && ChartControl.ChartTraderVisible)
{
acDbg("ChartTrader enabled and visible");
try
{
ctrAccount = (ComboBox)ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"];
acDbg("ctrAccount " + ctrAccount);
if (ctrAccount != null)
{
ctrSelectedAccount = (Account) ctrAccount.SelectedItem;
acDbg("ctrSelectedAccount " + ctrSelectedAccount);
if (ctrSelectedAccount != null)
{
ctrAccount.SelectedValueChanged += new EventHandler(accountChanged);
mySelectedAccount = ctrSelectedAccount.Name.ToString();
acDbg("mySelectedAccount " + mySelectedAccount);
if (mySelectedAccount != "")
{
acDbg("accountName was " + accountName + " now " + mySelectedAccount);
accountName = mySelectedAccount; // override ChartMinder Executions account
connectMyAccount("ChartTrader");
}
}
}
}
catch { acDbg("attach failed"); }
}
else
{
acDbg("No ChartTrader");
}
}
acDbg("out attach");
}
So basically, 'attachToChartTrader' sets up an event handler callback to 'accountChanged' and you can access the control's value in there or directly.
If you want the full gory story check out my ChartMinder thread.
Cheers
November 14th, 2014, 08:14 AM
Cluj-Napoca Cluj/Romania
Experience: Intermediate
Platform: NinjaTrader, MetaTrader 4
Broker: FXCM, Continuum
Trading: Forex, Futures
Posts: 12 since Apr 2013
Thanks Given: 6
Thanks Received: 7
ratfink
Code
private void accountChanged (object sender, EventArgs e)
{
if (ChartControl != null)
{
if (ChartControl.ChartTraderEnabled && ChartControl.ChartTraderVisible)
{
acDbg("accountChanged, ChartTrader is enabled and visible");
try
{
ctrAccount = (ComboBox)ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"];
acDbg("ctrAccount " + ctrAccount);
if (ctrAccount != null)
{
ctrSelectedAccount = (Account) ctrAccount.SelectedItem;
acDbg("ctrSelectedAccount " + ctrSelectedAccount);
if (ctrSelectedAccount != null)
{
mySelectedAccount = ctrSelectedAccount.Name.ToString();
acDbg("mySelectedAccount " + mySelectedAccount);
if (mySelectedAccount != "")
{
acDbg("accountName was " + accountName + " and now " + mySelectedAccount);
accountName = mySelectedAccount; // override ChartMinder Executions account
connectMyAccount("ChartTrader");
}
}
}
}
catch { acDbg("failed getting a/c change"); }
acDbg("out accountChanged");
}
}
}
private void attachToChartTrader ()
{
acDbg("attachToChartTrader CC " + ChartControl);
if (ChartControl != null)
{
if (ChartControl.ChartTraderEnabled && ChartControl.ChartTraderVisible)
{
acDbg("ChartTrader enabled and visible");
try
{
ctrAccount = (ComboBox)ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"];
acDbg("ctrAccount " + ctrAccount);
if (ctrAccount != null)
{
ctrSelectedAccount = (Account) ctrAccount.SelectedItem;
acDbg("ctrSelectedAccount " + ctrSelectedAccount);
if (ctrSelectedAccount != null)
{
ctrAccount.SelectedValueChanged += new EventHandler(accountChanged);
mySelectedAccount = ctrSelectedAccount.Name.ToString();
acDbg("mySelectedAccount " + mySelectedAccount);
if (mySelectedAccount != "")
{
acDbg("accountName was " + accountName + " now " + mySelectedAccount);
accountName = mySelectedAccount; // override ChartMinder Executions account
connectMyAccount("ChartTrader");
}
}
}
}
catch { acDbg("attach failed"); }
}
else
{
acDbg("No ChartTrader");
}
}
acDbg("out attach");
}
So basically, 'attachToChartTrader' sets up an event handler callback to 'accountChanged' and you can access the control's value in there or directly.
If you want the full gory story check out my ChartMinder thread.
Cheers
Ratfink,
I had a look at your "ChartMinder" software and I have to say, you rocked my world!!! I am trying to build something way more rudimentary than what you have there.
I have to thank you for the work that you have put into this indicator and just for the time that you have taken to respond to my posts.
With respect,
Maza.
Last Updated on November 14, 2014