Consider the following example:
I have a LONG position of 10 lots, opened at price 1000. In my strategy I have defined a PROFIT TARGET of 20. MC now correctly issues a take profit order to SELL 10 lots with LIMIT 1020. Suppose the price reaches this limit, but I get only a partial execution of 3 lots. MC should now have a remaining order to SELL 7 lots at LIMIT 1020.
Unfortunately, it cancels the remaining order and now issues a new order to SELL 7 lots at LIMIT 1040.
My strategy sometimes readjusts its profit target according to the market, so it has to call SetProfitTarget() more than once. The readjustments refer to EntryPrice(0) to calculate the opening price of the current position. I suspect that EntryPrice(0) delivers the price of the last execution (in the example above: 1020) instead of the opening price of the remaining position (in the example above: 1000).
Is this a bug in MC 5.5?
Is there any idea how to avoid this problem?
Partial Execution: Unexpected Profit Target
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
Partial Execution Straightforward
Straightforward:There is no guarantee for Limit order getting executed......so how would you propose to handle such a situation
1. The partially filled entry order remains in the market.
2. The newly acquired position is handled by the strategy, e.g. protected by PROFIT TARGET and STOP (i.e. a BRACKET).
3. When more lots of the entry order are filled, the sizes of the BRACKET are adjusted accordingly.
4. When PROFIT TARGET or STOP are hit, all other orders are cancelled (i.e. OCA group).
In order to achieve this, I would suggest to always submit the three orders ENTRY, PROFIT and STOP as an OCA group at the same time. This is a standard feature of Interactive Broker's TWS (and most other brokers as well). Those orders do take care of themselves when you use the default feature to automatically have their sizes adjusted to executions.
That would be a great improvement in MultiCharts and it should be quite simple to implement because IB does most of the work.
Re: Partial Execution Straightforward
OK, I see you are requesting for OCA type of orders feature in MC, which I think they are looking at it for future release.Straightforward:There is no guarantee for Limit order getting executed......so how would you propose to handle such a situation
1. The partially filled entry order remains in the market.
2. The newly acquired position is handled by the strategy, e.g. protected by PROFIT TARGET and STOP (i.e. a BRACKET).
3. When more lots of the entry order are filled, the sizes of the BRACKET are adjusted accordingly.
4. When PROFIT TARGET or STOP are hit, all other orders are cancelled (i.e. OCA group).
In order to achieve this, I would suggest to always submit the three orders ENTRY, PROFIT and STOP as an OCA group at the same time. This is a standard feature of Interactive Broker's TWS (and most other brokers as well). Those orders do take care of themselves when you use the default feature to automatically have their sizes adjusted to executions.
That would be a great improvement in MultiCharts and it should be quite simple to implement because IB does most of the work.
In addition to above you will still require replace to Market Partially filled orders, because at some point you will have to syncronise your chart and broker.
No, never. The chart should show what is being traded at the broker, not the other way round. I do not want to lose money just because of an insufficient trading platform.In addition to above you will still require replace to Market Partially filled orders, because at some point you will have to syncronise your chart and broker.
Sync mode in Multichart shows on chart what is being traded at the broker, it will, for sure get better once OCA type of orders are incorporated in to MC.No, never. The chart should show what is being traded at the broker, not the other way round. I do not want to lose money just because of an insufficient trading platform.In addition to above you will still require replace to Market Partially filled orders, because at some point you will have to syncronise your chart and broker.
It would be interesting to know about any other trading platform that you may know of which works on the principles you have just described.
I do not know of anything better than MC, but as a professional programmer I am considering to write my own trading tool. Nothing nearly as powerful as MC but a trading workhorse which submits orders with all details and controls executions and positions. I guess this would cost me about six months to do.It would be interesting to know about any other trading platform that you may know of which works on the principles you have just described.
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
you might have to build some routines with these new keywords
Power Language
• Information on the market position can now be received directly from a broker.
Four keywords to request and receive the market position from a broker have been added.
a) Market_Position_at_Broker_for_the_Strategy returns the market position at the broker for a given symbol and a particular strategy. Changes in the values returned by the word are based on the events at the broker. The word can only be used in signals and functions.
b) Market_Position_at_Broker returns the market position at the broker for a given symbol (irrespective of whether the position has resulted from orders submitted through a strategy or manually). Changes in the values returned by the word are based on the events at the broker. The word can only be used in signals and functions.
c) I_Market_Position_at_Broker_for_the_Strategy is similar to Market_Position_at_Broker_for_the_Strategy, the difference being that the former can be used in all types of studies (including indicators).
d) I_Market_Position_at_Broker is similar to Market_Position_at_Broker, the difference being that the former can be used in all types of studies (including indicators).
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
MarketPosition_at_Broker
Returns a numerical value, indicating the type of the specified position at the broker for the symbol.
A value of 1 indicates a long position, -1 indicates a short position, and 0 is returned only if the current position is specified and indicates that the current position is flat.
Usage
MarketPosition_at_Broker
Notes
This function can only be used in signals and functions.
This function differs from the marketposition keyword in that it cannot take an argument to reference past values.
This function can only be used with Interactive Brokers, Patsystems, and Zen-Fire.
Example
MarketPosition_at_Broker will return a 1 if the current position at the broker for the strategy is long.
MarketPosition_at_Broker will return a -1 if the current position at the broker for the strategy is short.
MarketPosition_at_Broker will return a 0 if the current position at the broker for the strategy is flat.
click Help at your MultiCharts program,
or at the View Navigation Bar window of your PowerLanguageEditor,
you will find the explanations in the PowerLanguage dictionary.