MC stop order backtest vs realtime logic  [SOLVED]

Questions about MultiCharts and user contributed studies.
glam_100
Posts: 157
Joined: 14 Jun 2006
Has thanked: 2 times
Been thanked: 4 times

MC stop order backtest vs realtime logic

Postby glam_100 » 14 Oct 2013

For this piece of code:

buy ("Entry 1") next bar high stop;
buy ("Entry 2") next bar high + 1 stop;
buy ("Entry 3") next bar high + 2 stop;

Let's leave "Allow multiple entry" option unchecked in strategy property.

In backtesting:

The strategy would have simulated filled at high ("Entry 1") but not at high + 1 ("Entry 2") ...etc. This is because high is closer to market price and would get filled first.

So far so good...

In real time:

TS would send out only the closest to market price stop order (ie. "Entry 1") and ignore all the other stop orders (ie. "Entry 2" ...etc). This is to make sure the real-time fill logic be the same as backtest (ie. Only the closest to market price stop order got filled).

MC would send out all orders "Entry 1","Entry 2", "Entry 3" ...etc. If there is a fill with "Entry 1" MC would cancel "Entry 2" and "Entry 3". However, very often in realtime, MC wouldn't have time to cancel the other others before they got filled. So all three orders would be penetrated in the broker's order server and got filled in many cases. This creates a problem with real-time history order fill un-match.

Another example:

buy ("Entry A") next bar 1minHigh stop;
buy ("Entry B") next bar 2minHigh stop;
buy ("Entry C") next bar 3minHigh stop;

There are times when all 1minHigh, 2minHigh, and 3minHigh are at the same price level say 1700.

In backtesting only 1 order would get filled buying 1 contract.

In real time:

TS would only send out only 1 order. Real-time fill logic the same as backtest.

MC will send out all 3 orders and all would get filled ending up with 3 contracts in total. Real-time fill logic *not* the same as backtest.

To get around this problem, very complex and tedious scripts with lots of real-time position checking and flagging code would have to be added by the user to make sure the real-time stop order fill is the same as backtest. Where as in TS we can use the same backtest code for real trading use as is without change.

Am I missing something? Is there a switch somewhere that can make the realtime stop order logic the same as backtest?

I'm in the process of finally migrating from TS to MC for execution. This is 1 of the last 2 problems I'm facing that has been putting me off switching from TS to MC. This is something fundamental in realtime stop order execution.

Many thanks!

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 279 times

Re: MC stop order backtest vs realtime logic

Postby MAtricks » 14 Oct 2013

You're not missing anything.. MC is extremely flawed with all floating orders. Limits orders are much worse. I've posted many examples and many topics about this and no one seems to take it seriously that this fantastic platform has these fatal bugs.

We need to fix on what's broken vs upgrades..

glam_100
Posts: 157
Joined: 14 Jun 2006
Has thanked: 2 times
Been thanked: 4 times

Re: MC stop order backtest vs realtime logic

Postby glam_100 » 14 Oct 2013

Realtime order management logic is something truly fundamental and needed to be fixed.

MC has now surpasses TS in features and function. However fundamental problems like this (I can find 2 fundamental problems including this one) has been stopping users to use it for actual trading.

Could anyone from MC support shed some light on this?

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: MC stop order backtest vs realtime logic

Postby Andrew MultiCharts » 17 Oct 2013

...
MC would send out all orders "Entry 1","Entry 2", "Entry 3" ...etc. If there is a fill with "Entry 1" MC would cancel "Entry 2" and "Entry 3". However, very often in realtime, MC wouldn't have time to cancel the other others before they got filled. So all three orders would be penetrated in the broker's order server and got filled in many cases. This creates a problem with real-time history order fill un-match.
...
With the help of this option the script will place only 1 of the 3 stop orders, if you don't allow multiple entries in the same direction Please read the description attentively.

User avatar
Henry MultiСharts
Posts: 9149
Joined: 25 Aug 2011
Has thanked: 1260 times
Been thanked: 2932 times

Re: MC stop order backtest vs realtime logic

Postby Henry MultiСharts » 17 Oct 2013

You're not missing anything.. MC is extremely flawed with all floating orders. Limits orders are much worse. I've posted many examples and many topics about this and no one seems to take it seriously that this fantastic platform has these fatal bugs.
We need to fix on what's broken vs upgrades..
This information is incorrect. None of the reported cases has shown an actual issue with limit orders execution.

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 279 times

Re: MC stop order backtest vs realtime logic

Postby MAtricks » 17 Oct 2013

You're not missing anything.. MC is extremely flawed with all floating orders. Limits orders are much worse. I've posted many examples and many topics about this and no one seems to take it seriously that this fantastic platform has these fatal bugs.
We need to fix on what's broken vs upgrades..
This information is incorrect. None of the reported cases has shown an actual issue with limit orders execution.
EXECUTION with limit orders is not flawless, but yes, you are correct it does work okay. However, BACK-TESTS of limit order execution is completely flawed.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: MC stop order backtest vs realtime logic

Postby Andrew MultiCharts » 17 Oct 2013

EXECUTION with limit orders is not flawless, but yes, you are correct it does work okay. However, BACK-TESTS of limit order execution is completely flawed.
Matricks, i believe i know what other topic from our forum you are referring and our support representatives are working with you on it. This topic is not related to that one. This topic is about how to limit number of generated orders. I will be glad to help you there.

hilbert
Posts: 224
Joined: 17 Aug 2011
Has thanked: 76 times
Been thanked: 64 times

Re: MC stop order backtest vs realtime logic

Postby hilbert » 18 Oct 2013

I read the optimize order flow section and it does take care of following issue. So, thanks to the MC team.
buy ("Entry 1") next bar high stop;
buy ("Entry 2") next bar high + 1 stop;
buy ("Entry 3") next bar high + 2 stop;

Let's leave "Allow multiple entry" option unchecked in strategy property.

In backtesting:
The strategy would have simulated filled at high ("Entry 1") but not at high + 1 ("Entry 2") ...etc. This is because high is closer to market price and would get filled first.
However, I am not sure if optimize order flow will take care of following also? From example3 , it seems, if position limit option in "strategy property" is not ticked; then when optimize order flow is used, MC will combine following orders into 1 order and increase the order size by 3 times. MC team - please confirm??
buy ("Entry A") next bar 1minHigh stop;
buy ("Entry B") next bar 2minHigh stop;
buy ("Entry C") next bar 3minHigh stop;

There are times when all 1minHigh, 2minHigh, and 3minHigh are at the same price level say 1700.

In backtesting only 1 order would get filled buying 1 contract.

In real time:
MC will send out all 3 orders and all would get filled ending up with 3 contracts in total. Real-time fill logic *not* the same as backtest.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: MC stop order backtest vs realtime logic

Postby Andrew MultiCharts » 18 Oct 2013

I will need to check it with our engineers. Get back once I haму any feedback from them.

glam_100
Posts: 157
Joined: 14 Jun 2006
Has thanked: 2 times
Been thanked: 4 times

Re: MC stop order backtest vs realtime logic

Postby glam_100 » 21 Oct 2013

I read the optimize order flow section and it does take care of following issue. So, thanks to the MC team.
buy ("Entry 1") next bar high stop;
buy ("Entry 2") next bar high + 1 stop;
buy ("Entry 3") next bar high + 2 stop;

Let's leave "Allow multiple entry" option unchecked in strategy property.

In backtesting:
The strategy would have simulated filled at high ("Entry 1") but not at high + 1 ("Entry 2") ...etc. This is because high is closer to market price and would get filled first.
However, I am not sure if optimize order flow will take care of following also? From example3 , it seems, if position limit option in "strategy property" is not ticked; then when optimize order flow is used, MC will combine following orders into 1 order and increase the order size by 3 times. MC team - please confirm??
buy ("Entry A") next bar 1minHigh stop;
buy ("Entry B") next bar 2minHigh stop;
buy ("Entry C") next bar 3minHigh stop;

There are times when all 1minHigh, 2minHigh, and 3minHigh are at the same price level say 1700.

In backtesting only 1 order would get filled buying 1 contract.

In real time:
MC will send out all 3 orders and all would get filled ending up with 3 contracts in total. Real-time fill logic *not* the same as backtest.

Andrew, I didn't know this option is now available which is great news. I will test it out a bit with different test cases.

I'm actually really excited cos this has been 1 of the 2 big pain in the aXX for me for trying to use MC for real trading.

Now if you could consider making an option/change so that MC would use closed bar for Data2 calculation instead of in-progress bar (forcing intrabar order generation type of calculation on Data2) then MC would be perfect for me finally!!!!

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: MC stop order backtest vs realtime logic

Postby Andrew MultiCharts » 21 Oct 2013

Andrew, I didn't know this option is now available which is great news. I will test it out a bit with different test cases.

I'm actually really excited cos this has been 1 of the 2 big pain in the aXX for me for trying to use MC for real trading.

Now if you could consider making an option/change so that MC would use closed bar for Data2 calculation instead of in-progress bar (forcing intrabar order generation type of calculation on Data2) then MC would be perfect for me finally!!!!
Thank you for your suggestion. All feature requests are forwarded to the management of the company and are evaluated in a timely manner. Please note that even though we value your opinion not all requests can be implemented due to the fact that some features do not fit into our current roadmap. Other customers are welcome to vote for it, as it may speed up the process.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 558 times

Re: MC stop order backtest vs realtime logic  [SOLVED]

Postby Andrew MultiCharts » 22 Oct 2013

However, I am not sure if optimize order flow will take care of following also? From example3 , it seems, if position limit option in "strategy property" is not ticked; then when optimize order flow is used, MC will combine following orders into 1 order and increase the order size by 3 times. MC team - please confirm??
buy ("Entry A") next bar 1minHigh stop;
buy ("Entry B") next bar 2minHigh stop;
buy ("Entry C") next bar 3minHigh stop;

There are times when all 1minHigh, 2minHigh, and 3minHigh are at the same price level say 1700.

In backtesting only 1 order would get filled buying 1 contract.

In real time:
MC will send out all 3 orders and all would get filled ending up with 3 contracts in total. Real-time fill logic *not* the same as backtest.
Checked with developers: if pyramiding is off (only 1 entry order in the same direction is allowed) and optimize order flow box is checked, only 1 stop order will be sent.

hilbert
Posts: 224
Joined: 17 Aug 2011
Has thanked: 76 times
Been thanked: 64 times

Re: MC stop order backtest vs realtime logic

Postby hilbert » 22 Oct 2013

However, I am not sure if optimize order flow will take care of following also? From example3 , it seems, if position limit option in "strategy property" is not ticked; then when optimize order flow is used, MC will combine following orders into 1 order and increase the order size by 3 times. MC team - please confirm??
buy ("Entry A") next bar 1minHigh stop;
buy ("Entry B") next bar 2minHigh stop;
buy ("Entry C") next bar 3minHigh stop;

There are times when all 1minHigh, 2minHigh, and 3minHigh are at the same price level say 1700.

In backtesting only 1 order would get filled buying 1 contract.

In real time:
MC will send out all 3 orders and all would get filled ending up with 3 contracts in total. Real-time fill logic *not* the same as backtest.
Checked with developers: if pyramiding is off (only 1 entry order in the same direction is allowed) and optimize order flow box is checked, only 1 stop order will be sent.
Thanks for quick revert. It makes sense and increases my confidence in MC.


Return to “MultiCharts”