takeprofit\ stoploss order execution

Questions about MultiCharts .NET and user contributed studies.
Bugs
Posts: 6
Joined: 20 Jul 2013

takeprofit\ stoploss order execution

Postby Bugs » 20 Jul 2013

hi,

In my strategy i am placing an order with tp and sl orders but i want to place next order only if my previous position is close i.e position is exited by either tp or sl. For this purpose how can i track tp\sp orders execution or is there any other way to fulfill this condition in multicharts.

Thanks

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

Re: takeprofit\ stoploss order execution

Postby Henry MultiСharts » 25 Jul 2013

Hello Bugs,

That is possible to trace the market position change or check the order status using TradeManager.

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: takeprofit\ stoploss order execution

Postby KhaosTrader » 22 Aug 2013

Henry, can we get a code example of this, where we get an id for the given position, and then can make queries against the id to find the status and state of the position?

Thanks in advance

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

Re: takeprofit\ stoploss order execution

Postby Henry MultiСharts » 23 Aug 2013

KhaosTrader, you can access this information via TradeManager. Please find the code examples here: 1, 2.

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: takeprofit\ stoploss order execution

Postby KhaosTrader » 23 Aug 2013

Yes but trademanager wont give info for backtesting, what would i use if i need this for backtesting?

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

Re: takeprofit\ stoploss order execution

Postby Henry MultiСharts » 26 Aug 2013

TradeManager class cannot be used in backtesting. TradeManager provides access to the Order and Position Tracker window that contains information only regarding actual trades generated and sent to the broker.

PowerLanguage Backtester works differently from the broker connection. On a study calculation a set of orders is generated. Orders live until the next study calculation. The orders are not actually sent to the broker, orders do not have any IDs and they cannot be accessed directly.

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: takeprofit\ stoploss order execution

Postby KhaosTrader » 27 Aug 2013

Could we access open positions and closed positions for strategy management that would be available for backtesting if we use the

Positions[0].OpenTrades[1].EntryOrder...

Is it possible to get a serial number of the entry order that is filled so we can track it some way?

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

Re: takeprofit\ stoploss order execution

Postby Henry MultiСharts » 28 Aug 2013

KhaosTrader,
That is possible to access open and closed positions information in backtesting via Positions[](IMarketPosition).
Is it possible to get a serial number of the entry order that is filled so we can track it some way?
Check out ITradeOrder Members to learn what order information is available.

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: takeprofit\ stoploss order execution

Postby KhaosTrader » 28 Aug 2013

Can you give me some code examples using ITradeOrder

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

Re: takeprofit\ stoploss order execution

Postby Henry MultiСharts » 30 Aug 2013

Please check our Wiki:Strategy Performance and the attached code.
Attachments
Test_BackTest_OrdersInfo.pln
(2.07 KiB) Downloaded 447 times


Return to “MultiCharts .NET”