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
takeprofit\ stoploss order execution
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: takeprofit\ stoploss order execution
Hello Bugs,
That is possible to trace the market position change or check the order status using TradeManager.
That is possible to trace the market position change or check the order status using TradeManager.
-
- Posts: 186
- Joined: 10 May 2012
- Has thanked: 14 times
- Been thanked: 11 times
Re: takeprofit\ stoploss order execution
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
Thanks in advance
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: takeprofit\ stoploss order execution
KhaosTrader, you can access this information via TradeManager. Please find the code examples here: 1, 2.
-
- Posts: 186
- Joined: 10 May 2012
- Has thanked: 14 times
- Been thanked: 11 times
Re: takeprofit\ stoploss order execution
Yes but trademanager wont give info for backtesting, what would i use if i need this for backtesting?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: takeprofit\ stoploss order execution
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.
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.
-
- Posts: 186
- Joined: 10 May 2012
- Has thanked: 14 times
- Been thanked: 11 times
Re: takeprofit\ stoploss order execution
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?
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?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: takeprofit\ stoploss order execution
KhaosTrader,
That is possible to access open and closed positions information in backtesting via Positions[](IMarketPosition).
That is possible to access open and closed positions information in backtesting via Positions[](IMarketPosition).
Check out ITradeOrder Members to learn what order information is available.Is it possible to get a serial number of the entry order that is filled so we can track it some way?
-
- Posts: 186
- Joined: 10 May 2012
- Has thanked: 14 times
- Been thanked: 11 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: takeprofit\ stoploss order execution
Please check our Wiki:Strategy Performance and the attached code.
- Attachments
-
- Test_BackTest_OrdersInfo.pln
- (2.07 KiB) Downloaded 454 times