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)
Platform: TradeLink, OpenQuant, considering anything that works...
Trading: if it trades...
Posts: 94 since Oct 2010
Thanks Given: 24
Thanks Received: 39
Hi,
I’m wondering if I could share some ideas on managing multiple orders in NT?
Given that you can’t create IOrder objects (as it is an interface) I’m wondering what is people usual approach to this?
I’ve been pursuing a possible approach around putting IOrder in a List (System.Collections.Generic) as they are created. Then you can search the list for the last order created to know which one was the last entry.
I see that NT is going to fix this in Version 8 access to the orders of open positions (thanks for Big Mike to organising the walk-through the other week).
Thanks and regards,
drolles
Can you help answer these questions from other members on NexusFi?
However, it doesn’t appear to work in backtest. I’m assuming the “Accounts” is for live accounts only? Though it is funny I would have through there is some sort of backtest account. Any suggestions for backtest?
What do you need unmanaged orders for in a backtest? I don't know much about strategies and backtests... @NJAMC or @Xav1029 should be more proficient regarding strategies.
Platform: TradeLink, OpenQuant, considering anything that works...
Trading: if it trades...
Posts: 94 since Oct 2010
Thanks Given: 24
Thanks Received: 39
Thanks for the prompt reply.
I’m ok on using managed. I have a situation where I’m looking to do multiple entries (against the same instrument). I’m doing some testing on some ideas ( Nuclear Phynance).
I was thinking that I would create a list of entryOrders, targetOrders and stopOrders; using a number to signify the entry number (e.g. Long Entry 1).
I would then check if each entryOrder is filled to determine if there is a corresponding target and stop order for the position. Something like this:
foreach (IOrder x in entryOrders)
{
if (x != null)
{
if (x.OrderState == OrderState.Filled)
{
// check to see if a stop / target exists if it does check it state to make sure it isn't fulled
int orderNumber = Int32.Parse(x.Name.Substring(x.Name.Length - 1));
}
}
}
I don't do strategies either...I love the chart trader, so I've just been tweaking it lately to do some extra tricks like dataseries trails. I really don't know much about backtesting except that I was always rich after optimization
Platform: TradeLink, OpenQuant, considering anything that works...
Trading: if it trades...
Posts: 94 since Oct 2010
Thanks Given: 24
Thanks Received: 39
Tried these, but none of them worked.
foreach (Execution x in this.Executions)
{
if (x.Name.Contains("Short Entry")) {
Print(x.Name);
}
}
foreach (Order x in this.Orders)
{
if (x != null)
{
Print(x.Name);
}
}
They all remain null even through there are positions live and executions have occurred.
Anyone with any ideas? All help greatly appreciated if we can put a work around in place prior to NT 8 coming out.
I really don't know much about backtesting except that I was always rich after optimization
Absolutely. Shame more folks can't see it out of the box. If a feature is worthwhile and means something in a generic context then it always will, anything else is just fly-by-night/fly-by-wire/fly-by-seat-of-pants conformed noise. On the other hand I guess some manage to use it profitably so yet another example of what makes a market. Me, strictly discretionary.
Platform: TradeLink, OpenQuant, considering anything that works...
Trading: if it trades...
Posts: 94 since Oct 2010
Thanks Given: 24
Thanks Received: 39
One possible solution I think I’ve come to is keeping a list of open execution.
That is when OnExecution is called to open a solution position (“Long Entry 1”) add it to a list for Open Executions.
openExecutions.Add(execution);
Also we need to remove it when the execution is closed
else if (execution.Order.Name != "" && (execution.Order.Name.Contains("Long Target") || execution.Order.Name.Contains("Long Target")))
{
string orderNumber = execution.Order.Name.Substring(execution.Order.Name.Length - 1);
int indexNum = 0;
foreach (IExecution y in openExecutions)
{
if (y.Order.Name.Contains(orderNumber))
{
indexNum++;
break;
}
indexNum++;
}
openExecutions.RemoveAt(indexNum);
}
It relies on the fact that we are keeping a unique number to append to the back of the IOrder text. I do this by just having a method to increment it each time it is called (might better doing it via a Property?).