Slippage - Market Orders 9 minutes late and 30 points off

Questions about MultiCharts and user contributed studies.
TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Slippage - Market Orders 9 minutes late and 30 points off

Postby TA100 » 01 Apr 2014

I'm interested to know what MC users are seeing as slippage for Market orders? 1-2 points maybe or perhaps a 1-5 second delay in your order being filled?

My charts (the 2 data strat uses IOG on 10 min charts) are painting 'market' orders on my charts up to 9 minutes after price touched that level which is sometimes up to 30 points away - of course the slippage is never positive.

So I am perplexed, how could this be a "Buy at market" or " Sell at market" order just so far from where price is trading when the entry is painted.

Any ideas from you veterans?

Thanks.

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

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby MAtricks » 01 Apr 2014

A lot more details are required to know what you're talking about. Are you talking about the actual execution or the way that MC paints the filled orders

Slippage of 30 points??? I've seen slippage in my time, but that doesn't make sense.

Please reply with a pic of your chart showing this.

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 01 Apr 2014

MA Tricks I will post a pic tomorrow since I shut the platform.

However the behaviour is as follows - a 10 min bar opens hypothetically at 100 and after 9 minutes the price has moved to 97 at which point (ie 9 minutes through the bar) MC paints a short entry on the bar at 100 or less.

The orders are buy or sell 'next bar at market' which for an IOG strategy is next tick.

So my problem is twofold - Firstly the strategy is not executing at market as per the order or on the next tick because the last is inevitably some distance from the entry.

If somehow my coding was wrong and the strat is in fact executing on time then the painted entryprice on the chart is wrong too since it should be approximate to the 'last' give a tick or two and notwithstanding fast market conditions.

Either way I've not seen behaviour like this on any other platform. The data feed is TS which works fine and realtime history matching is unchecked.

I am stumped...and so it seems is MC Support.

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

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby MAtricks » 01 Apr 2014

My guess is that its a coding issue or hardware issue.

Can you post a snap of your execution code as well as the screen shot?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby JoshM » 02 Apr 2014

I am stumped...and so it seems is MC Support.
Can you mention what things you and MC Support have already explored? Otherwise people in this thread might be reinventing the wheel.
If somehow my coding was wrong and the strat is in fact executing on time then the painted entryprice on the chart is wrong too since it should be approximate to the 'last' give a tick or two and notwithstanding fast market conditions.
I thought that the entry price (and the accompanying time) is based on the reported entry price and time from your broker. If you have a time difference between your pc and your broker's, there might be a big lag.
My guess is that its a coding issue or hardware issue.

Can you post a snap of your execution code as well as the screen shot?
This. Or otherwise a broker/instrument issue. Which instrument and broker are you talking about? If you have, for example, a CFD chart based on Trade, 9 minutes between consecutive ticks can be considered quick. :]

Furthermore, what does your own log (which keeps track of the strategy) tells you?
If somehow my coding was wrong and the strat is in fact executing on time then the painted entryprice on the chart is wrong too since it should be approximate to the 'last' give a tick or two and notwithstanding fast market conditions.
You probably already have tried, but just to rule it out: have you tried using RecalcLastBarAfter?

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 02 Apr 2014

Thanks JoshM

The symbols are TFM14 and ESM14, Russell 2000 and S&P emini futures - hardly exotics!
The strategy uses 10 minute as data1 and 1 minute as data2. Same symbol used in data1 and data2 so no issue there and both time and price between MC & TS look synchronised on the screen.

As you will know the log is only useful when trading live. But for this problem just forget the issue of live fill comparisons since 'as is' the strategy is completely untradeable 'live'. The simple issue is why any 'market orders' using an IOG strategy would paint on a chart so far from the prevailing market price. It would seem to me that either the signal is delayed and the right delayed price is erroneously painted as a market entry or the signal is not delayed and the wrong last price is painted...either way unsatisfactory.

I was hoping MC support may answer the question - under what conditions would a market order not paint at prevailing market prices...unchecking realtime history checking was proposed but that appears to make no difference.

I cannot find the function RecalcLastBarAfter in MC or TS - perhaps you could attach it to another post or send a link and explain how you would use it?


Thanks

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby ABC » 02 Apr 2014

MichaelS,

to make sure, are you trading "live on a simulated account" or are you just watching the symbol on the chart?

When does your code send the order? Check this with print statements in the code. The point for this it to rule out that the condition doesn't simply become true 9 minutes into the bar.

How does the same code behave in TS?

It might not matter too much for your type of code, but in general I would always try to make the fastest datastream data1.

Regards,
ABC

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby JoshM » 02 Apr 2014

As you will know the log is only useful when trading live.
I meant a custom log for testing the strategy, such as writing text to the output window or a text file so that the strategy can be tracked. Such a thing can be very helpful, especially for situations like this one.
But for this problem just forget the issue of live fill comparisons since 'as is' the strategy is completely untradeable 'live'. The simple issue is why any 'market orders' using an IOG strategy would paint on a chart so far from the prevailing market price. It would seem to me that either the signal is delayed and the right delayed price is erroneously painted as a market entry or the signal is not delayed and the wrong last price is painted...either way unsatisfactory.
Do you have an example code of the strategy that displays this behaviour? That would help to make concrete suggestions.
I cannot find the function RecalcLastBarAfter in MC or TS - perhaps you could attach it to another post or send a link and explain how you would use it?
`RecalcLastBarAfter`is a default MultiCharts keyword (not a function that can be exported), and was at least a few years ago introduced in MultiCharts. Just to verify, which MultiCharts version do you use?

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 02 Apr 2014

Thanks ABC, my answers below
MichaelS,

to make sure, are you trading "live on a simulated account" or are you just watching the symbol on the chart?

Obviously tried trading it live but stopped pretty sharpish - thought there would be an obvious answer but closer inspection of the strat on 2 symbols and different time frames show the same behaviour

When does your code send the order? Check this with print statements in the code. The point for this it to rule out that the condition doesn't simply become true 9 minutes into the bar.

Good point - I have the code to test when the conditions are met which I will add, and also add a time print statement to the orders- just trying to eyeball the indicator version today to see if that shows up an obvious discrepency -

However, even if the order was issued 9 minutes through the bar why would the market order entry paint near the open....odd indeed



How does the same code behave in TS?

Like many tasks in TS its not possible, no IOG with 2 data streams unless using OOEL which is - well better not get started on that..

It might not matter too much for your type of code, but in general I would always try to make the fastest datastream data1.

Yes agreed - if 10 and 1 cant work for some reason with IOG then I may have to try that.

Regards,
ABC
Thanks for your ideas.

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby ABC » 02 Apr 2014

Are you using the Bar Magnifier and what is the resolution of it? This question only makes sense if you are seeing the issues on historic trades. For the trades with realtime data the ticks are processes as they come in.

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 02 Apr 2014

Hi ABC, bar magnifier is turned off.

Here is typical situation from today - about a minute left on the bar and the strat paints a market entry at 1183.30 when actual price is around 1184.50 (it took me 5-6 seconds to snap it)
Attachments
Ex1.PNG
(11.67 KiB) Downloaded 1867 times

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 02 Apr 2014

Here is the behaviour captured precisely -

Position is short @ 1187.5 with 1 minute 16 seconds left on bar

Within 15 seconds miraculously a long market position is painted at 1186.50 when the price (as can be seen is above 1188).

Great market orders!
Attachments
Great_Market_Orders_!!.pdf
(48.56 KiB) Downloaded 198 times

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby ABC » 02 Apr 2014

MichaelS,

it's almost impossible to guess from the charts what's going on. As others have pointed out, posting the order entry part and the results of your print log (i.e. something where you can clearly see when the market order was triggered exactly) can give us some insights on how to help you.

Regards,
ABC

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

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby hilbert » 03 Apr 2014

you should post code, then it will be much easier to figure out what is going wrong.

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 03 Apr 2014

Hilbert, thanks buts there are 2-3 proprietary functions so that is not possible.

However, the issue is more fundamental than my code or in fact anyone's code - to quote MC support

"market order = order to buy/sell at current price. Current price = market price right after the order is generated by your code."

And of course this is NOT happening. Market Order entries are being painted on bars up to ($350 today) away from where price was trading. So it can be one of two problems - either the order is timely and the WRONG market price is being painted - or - the order is delayed for some reason and the order price is painted but not the current price.

So maybe you see why I am so irritated by this whole issue, either way using IOG on MC is not doing what it should. Which leads me to ask the question as widely amongst other MC users - are your market orders being painted on bars so distinctly away from the "Current market price?" If so I would be most grateful to hear from you and compare notes!!!

Thanks

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby ABC » 03 Apr 2014

MichaelS,

no one expects you to post your full code, just the part doing the problematic entries. If this uses proprietary functions change them to something public domain. See if the problem still exists than post this code.
I have never seen the issue you are describing on my end. Which doesn't mean there can't be a problem with market orders in MC, but if there is it seems it's not easily to reproduce. That's also why the demonstration code would be very helpful.

Regards,
ABC

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

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby MAtricks » 03 Apr 2014

I've never dealt with nor even heard of your issue so it sounds exclusive to you..

There's a very high chance that the issue is in the code. If you post execution code here, we can help. If not, try to fix it by looking at the code yourself.

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 03 Apr 2014

ABC & MATricks

Here are the conditions. Maybe you can see something..

Condition1=t>Stime and t<Etime;
Condition8=Value9[01]<=0 or Value9[02]<=0;
Condition9=Value9[01]>=0 or Value9[02]>=0;
Condition2=Open>Value1+fac and Value9>0 and Condition8;
Condition3=Open<Value1-fac and Value9<0 and Condition9;

If Condition1 then begin

If Condition2 then sell short next bar at market;
if Condition3 then buy next bar at market;

end;

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

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby MAtricks » 03 Apr 2014

This code is too vague for us to verify an IOG strategy.

Have you used a tick by tick back-test for this strategy? The bar magnifier has some oddities that don't seem to work well with multiple data streams.

**Make sure that the faster data is data1.

beck donald
Posts: 199
Joined: 25 Jan 2008
Has thanked: 2 times
Been thanked: 7 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby beck donald » 03 Apr 2014

I do not use market orders...

1. Click on Order tab. What time is the order placed?
2. What time is it filled?
3. Go to time and sales and confirm prices at time of order and time of fill.


If the order is placed at the "correct time", you have a market issue and need to have a discussion with your broker.

If the order did not go out at the correct time, you have a technology issue. If it were me...
1. I would get a demo account going
2. Speed things up so I have more events.
3. Change the chart to Async to help identify where the issue might be
4. Add a message log or print command to your code
5.If the broker has their own execution platform and both can be logged into at the same time, I would look at it to see when the broker shows the order coming in.

Lots more steps can be taken, try these first.
Don

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 03 Apr 2014

MA Tricks

Yes, I have used bar magnifier and that doesn't show up any issues - the strat will issue and paint orders approximate to the the current price 60% of the time but then it will give the behaviour in the pdf -

I'll replace my functions with canned ones and see if it replicates.

Thanks.

beck donald
Posts: 199
Joined: 25 Jan 2008
Has thanked: 2 times
Been thanked: 7 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby beck donald » 03 Apr 2014

I saw your code after I posted...

Condition1=t>Stime and t<Etime;
Condition8=Value9[01]<=0 or Value9[02]<=0;
Condition9=Value9[01]>=0 or Value9[02]>=0;
Condition2=Open>Value1+fac and Value9>0 and Condition8;
Condition3=Open<Value1-fac and Value9<0 and Condition9;

If Condition1 then begin

If Condition2 then sell short next bar at market;
if Condition3 then buy next bar at market;


When I code I use Value1[0] or [1]. No idea if it makes a difference.

But what is clear, your saying if the condition is met to do the trade at next bat at market.

If your 10 seconds into the bar and conditions are met, you could have almost 10 minutes for that order to go out, if data1 is 10 minutes.

Don

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 03 Apr 2014

Beck Donald, thank you for your ideas some of which I can implement right away -

As a matter of interest why would you not use market orders? And why do you suggest Async mode would be easier to identify where the problem may be?

Thanks.

I do not use market orders...

1. Click on Order tab. What time is the order placed?
2. What time is it filled?
3. Go to time and sales and confirm prices at time of order and time of fill.


If the order is placed at the "correct time", you have a market issue and need to have a discussion with your broker.

If the order did not go out at the correct time, you have a technology issue. If it were me...
1. I would get a demo account going
2. Speed things up so I have more events.
3. Change the chart to Async to help identify where the issue might be
4. Add a message log or print command to your code
5.If the broker has their own execution platform and both can be logged into at the same time, I would look at it to see when the broker shows the order coming in.

Lots more steps can be taken, try these first.
Don

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 03 Apr 2014

Thanks Don, I will try Value1[0] (or even as Sam Tennis does it [00]) since it hasn't got the same treatment as Value9

The strat is IOG though so when condition2 or 3 are met my understanding is that the market order should fire next tick.

MC support told me that IOG in fact related to data1 not data2 and the only reference to data2 in the code is in the Value1 function. So I figured even if that were responsible it would only delay the order by 1 minute rather than the many it is showing.

I saw your code after I posted...

Condition1=t>Stime and t<Etime;
Condition8=Value9[01]<=0 or Value9[02]<=0;
Condition9=Value9[01]>=0 or Value9[02]>=0;
Condition2=Open>Value1+fac and Value9>0 and Condition8;
Condition3=Open<Value1-fac and Value9<0 and Condition9;

If Condition1 then begin

If Condition2 then sell short next bar at market;
if Condition3 then buy next bar at market;


When I code I use Value1[0] or [1]. No idea if it makes a difference.

But what is clear, your saying if the condition is met to do the trade at next bat at market.

If your 10 seconds into the bar and conditions are met, you could have almost 10 minutes for that order to go out, if data1 is 10 minutes.

Don

beck donald
Posts: 199
Joined: 25 Jan 2008
Has thanked: 2 times
Been thanked: 7 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby beck donald » 03 Apr 2014

Async will show you the moment your math causes a signal. It does not care about the broker or market conditions. When your code conditions are met, it will fire. You might make Strat1 and Strat2 and run them both at the same time. One Async and the other Sync. Sync care nothing about your code, if the broker does not fill you, no signal.
This is to help isolate the problem areas.

Over the years, slippage both from market conditions and time has caused me lots of grief. So I developed ways to use a limit instead.

If IOG is working as it should, when the next tick hits, it is suppose to equal next bar, however your describing a situation that to me seems a bit to similar time wise.

If you can run your code on 10 min and 1 min bars, how about 10 second and 1 second bars?
Same things should happen, technically. Not talking about making money, talking about the termites and finding them. If you get a 10 second delay and a 3 pt slip..maybe IOG isn't doing what it should?

Running a messagelog will show you by hard numbers what is going on. I have been doing this for a very long time. With my concepts developed and proven, at least 80 to 90% of my time is debugging and developing work-a-rounds, but I push the envelope. So would I be stunned to find an issue with IOG? :)


Beck Donald, thank you for your ideas some of which I can implement right away -

As a matter of interest why would you not use market orders? And why do you suggest Async mode would be easier to identify where the problem may be?

Thanks.

I do not use market orders...

1. Click on Order tab. What time is the order placed?
2. What time is it filled?
3. Go to time and sales and confirm prices at time of order and time of fill.


If the order is placed at the "correct time", you have a market issue and need to have a discussion with your broker.

If the order did not go out at the correct time, you have a technology issue. If it were me...
1. I would get a demo account going
2. Speed things up so I have more events.
3. Change the chart to Async to help identify where the issue might be
4. Add a message log or print command to your code
5.If the broker has their own execution platform and both can be logged into at the same time, I would look at it to see when the broker shows the order coming in.

Lots more steps can be taken, try these first.
Don

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby tony » 05 Apr 2014

Pardon me for posting without reading the entire thread. But when I read the title of the post, real time history matching jumped to mind right away and I wanted to at least note that you may need to uncheck that. In testing a sim account I found out the hard way about that. My market order was submitted AFTER all bars were completed and thus my market order was about 10 minutes late and a few ticks in the ZB. If this was already said, my apologies.

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

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby Andrew MultiCharts » 07 Apr 2014

Market order is placed on open of next bar if conditions for its generation are satisfied at strategy calculation on current bar close (IOG = OFF); on next tick if conditions for its generation are satisfied at strategy calculation on current tick (IOG = ON). The "Real-Time History Matching" and referencing additional data series should not affect market order placement. Please note that if you use "print" keyword in your code, you may see multiple "dummy calculations", showing your market orders should be sent, when you reference additional data series. Only ticks on data 1 affects if a market order should be placed or not.

beck donald
Posts: 199
Joined: 25 Jan 2008
Has thanked: 2 times
Been thanked: 7 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby beck donald » 08 Apr 2014

If your still stuck...

I read somewhere that history matching can cause a delay.

TA100
Posts: 54
Joined: 10 Feb 2014
Has thanked: 39 times
Been thanked: 9 times

Re: Slippage - Market Orders 9 minutes late and 30 points of

Postby TA100 » 07 Nov 2014

If your still stuck...

I read somewhere that history matching can cause a delay.
Hello Don

Yes, most odd MC support advised me to switch History matching OFF yet Andrew suggests with IOG enabled and HM set to ON provided conditions are met the order will fire on the next tick of data 1 as that still doesn't account for a market order being painted on the bar 10-30 points from price at the time of the paint. The default for History Matching should be OFF rather than ON.

I still have market or buy/sell at open orders just painting on a chart when price has left the vicinity even with HM OFF.


Return to “MultiCharts”