How use the ITradeOrder interface  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
Phonix88
Posts: 17
Joined: 12 Sep 2013
Has thanked: 10 times
Been thanked: 2 times

How use the ITradeOrder interface

Postby Phonix88 » 18 Sep 2013

Hi to all, I'm again here for a help.
This time I'm trying to use the ITradeOrder informations but only with the reference guide and the informations on the forum I'm not able to reclaim this.

So, can anyone make an example about this as was made in this post for the ITrade interface: http://www.multicharts.com/discussion/v ... 624#p64624

Again, thanks a lot.

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1526 times
Been thanked: 1502 times
Contact:

Re: How use the ITradeOrder interface

Postby JoshM » 19 Sep 2013

I have the same question; I couldn't find it in the manual (or overlooked it) and trail & erroring didn't help here.

User avatar
Henry MultiСharts
Posts: 9121
Joined: 25 Aug 2011
Has thanked: 1258 times
Been thanked: 2927 times

Re: How use the ITradeOrder interface  [SOLVED]

Postby Henry MultiСharts » 20 Sep 2013

Please check our Wiki:Strategy Performance and the attached codes.

Test_PositionInfo.pln: t.EntryOrder.Price, t.ExitOrder.Price. EntryOrder and ExitOrder are examples of ITradeOrder.

Test_BackTest_OrdersInfo.pln:
Positions is a collection of closed trades present on a chart.
Each position can consist of multiple trades (if you have pyramiding enabled)-multiple entries and exits into the same position are possible.
OpenTrades.Count – amount of orders opening the current position.
ClosedTrades.Count – amount of orders closing the current position.
See the comments in the code:

Code: Select all

{
for (int i = 0; i < Positions.Count; i++)
{
IMarketPosition mp = Positions[i];
// - reference a certain trade.
Output.WriteLine( " Count Closed Trades = {0}, Count Opend Trade = {1}", mp.ClosedTrades.Count, mp.OpenTrades.Count);
// - output how many opening and closing orders were in this single trade

if (mp.ClosedTrades.Count > 0)
// - checks how many closing orders were in this position
{
for (int j = 0; j < mp.ClosedTrades.Count; j++)
// - if there were more than 0 then in this cycle scroll all closing orders
{
ITrade trd = mp.ClosedTrades[j];
Output.WriteLine( "EntryOrder.Price = {0}", trd.EntryOrder.Price );
//output the price of each order that closed the position.
}
}
Attachments
Test_PositionInfo.pln
(1.97 KiB) Downloaded 391 times
Test_BackTest_OrdersInfo.pln
(2.07 KiB) Downloaded 388 times

Phonix88
Posts: 17
Joined: 12 Sep 2013
Has thanked: 10 times
Been thanked: 2 times

Re: How use the ITradeOrder interface

Postby Phonix88 » 23 Sep 2013

Again thanks


Return to “MultiCharts .NET”