Bars Since Exit  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
clonardo
Posts: 16
Joined: 27 Sep 2013
Has thanked: 1 time
Been thanked: 1 time

Bars Since Exit

Postby clonardo » 27 Sep 2013

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.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Bars Since Exit  [SOLVED]

Postby Henry MultiСharts » 01 Oct 2013

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.

clonardo
Posts: 16
Joined: 27 Sep 2013
Has thanked: 1 time
Been thanked: 1 time

Re: Bars Since Exit

Postby clonardo » 04 Oct 2013

Thanks, Henry, that seems to answer it.


Return to “MultiCharts .NET”