Hi,
From what I've read, in MultiCharts (but not MC.NET) there's a BarsSinceExit() function that will return the number of bars since exiting the previous position.
Is there something similar in MC.NET that can be used in strategy & portfolio backtesting? I have tried to find a way to identify the bar at which the last position was closed out, but haven't been able to do so yet. Thanks in advance.
Bars Since Exit [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Bars Since Exit [SOLVED]
Hello clonardo,
In MultiCharts .NET there is Positions object (IMarketPosition collection) where all orders (order collections), which have opened (OpenTrades) and closed (ClosedTrades) specific positions, are stored. Each set of OpenTrades and ClosedTrades has EntryOrder collection and ExitOrder collection. Each order from this collection has BarNumber property. If you receive its value, you can calculate when (how many bars back) the order was executed.
In MultiCharts .NET there is Positions object (IMarketPosition collection) where all orders (order collections), which have opened (OpenTrades) and closed (ClosedTrades) specific positions, are stored. Each set of OpenTrades and ClosedTrades has EntryOrder collection and ExitOrder collection. Each order from this collection has BarNumber property. If you receive its value, you can calculate when (how many bars back) the order was executed.