Slippage Issue
Author: Christos
Creation Date: 3/30/2011 8:24 AM
profile picture

Christos

#1
I have noticed that the price a trade is done can't be less than the low of the specific bar even if the slippage set would create an adjusted entry price lower than that. Is there any way to overcome that issue?
profile picture

Eugene

#2
No, it couldn't happen.

Any example?
profile picture

Christos

#3
I suppose that when you say that it couldn't happen you mean that it can't happen to trade at a lower price than the lower of the day. If this is what you mean I could think of two examples. The first is that when you have only closing prices (assume open=high=low=close) then you can't aply any slippage at all. Another example is a stop order that may be triggered at the low of the day. If the bars represent mid prices then that is not the price that the trade will be executed.
profile picture

Cone

#4
Wealth-Lab isn't going to create trades outside a bar's range, not now or in the future.

If the low of the day is the low of the day, trades didn't and wouldn't trade at a lower price. If you want to penalize yourself, then you can increase your commission costs.

Also, keep in mind that slippage works both ways, but you're only penalized for using it when backtesting.
profile picture

Dave B.

#5
QUOTE:
Wealth-Lab isn't going to create trades outside a bar's range, not now or in the future.


Cone may I disagree with the utmost respect?

While I am still a happy WL4 user, there is one issue with the way Wealth-Lab calculates the number of shares using the Basis Price that I have never gotten used to.

Run the following one (1) line on Apple in Raw Profit Mode, Fixed Dollar of $50,000 (Please forgive the WL4 example, but Eugene has confirmed this on WL6).

CODE:
Please log in to see this code.


Wealth-Lab uses the Stop Price of $1.00 (clearly outside the bar's range) as the Basis Price to calculate the number of shares as 50,000 and then buys 50,000 shares at the open price of the next bar. In this example the user would spend $17,403,500.00 (50,000 x $348.07). The trade would not be filled in real life but in the backtest...

You have commented that the Fixed Dollar mode can be misleading, but I have always been troubled by this result.

Again, I love Wealth-Lab and find your support second to none.
profile picture

Eugene

#6
Dave,

You're questioning the design, good or bad, that is to size AtStop/AtLimit orders off of their trigger price. In RP mode, yes, this funky AAPL trade will work, but in Portfolio Simulation mode, never. Again, by design that says "take all signals in RP mode". Your stop order is absolutely valid and MUST have been triggered because AAPL's open price will most likely be higher than $1.0 (no, way higher). Therefore I take your complain to how sizing works in RP mode, not about the basis price.
profile picture

Cone

#7
QUOTE:
Wealth-Lab uses the Stop Price of $1.00 (clearly outside the bar's range)
Hi Dave. When a stop order is entered, you theoretically don't know the bar's range on which it will be executed (unless you're peeking). Notwithstanding, even with that stop order WL won't and can't create a trade outside the bar's range.

I'm not even sure why creating a trade where a trade never occurred is a point of contention, but I'm quite sure that if Wealth-Lab did that, it would be considered a bug by many more users!
profile picture

Dave B.

#8
I am honored to have both of the experts responding.

1. You are absolutely right that in Simulation Mode no trades of this nature will be taken

2. You are probably also right that my concern is more centered on Raw Profit Mode

3. I must ask "How would a broker handle this order?"

4. What would the IB API do? Partial fill up to the account value? (You can tell I'm wary of trying it)

5. Finally, could the design be improved by checking the sizing with the range of the entry bar?

As always, great to interact with the support team.
profile picture

Cone

#9
3. I think most brokers use logic to reject orders stop/limit orders that are too far away from the inside market, but it would vary by broker. You could implement your broker's logic in your script for backtesting. For live trades, the broker will take care of it.

4. I guess any broker would reject an order for $17,403,500.00 if your account couldn't cover it.

5. That's peeking, so probably not. It seems to me that Wealth-Lab takes more care than other TA apps to not peek when it comes to sizing positions. That's the point of the basis price, and it's why 100% equity sizing is so difficult to achieve.

Let's look at it the other way around. Why would your script ever indicate a $1 stop order for a stock that you know is trading at, say, $350?
profile picture

Dave B.

#10
Cone:

Let's discuss point number 4 first. In my testing, IB will fill a large (or incorrect) order until you run out of money using margin, if necessary and available. I have not found a foolproof way to limit this in real-time trading. I have wrestled with this problem even more since Ted Climo's article on Dip Buying in Active Trader (congratulations Ted!) and Volker’s Widner Bands article. (I must say, I find the work MS123 does for the articles outstanding).

I have experimented with the real-time trading controls in WL4 (Trading Thresholds) and found them insufficient. We are in the process of creating additional software to manage this task in real time. We have also submitted a formal request to IB software development to examine their user risk controls and provided suggested enhancements, though I am not holding my breath. WL6 cannot trade at IB at this time.

Should we start a new topic?

As to point 5, my concern is that during programming and testing of many systems, it is easy to make an error in calculating a Stop Price, for example. I look to Wealth-Lab to provide results as realistic as possible. If I make a mistake, Wealth-Lab will buy 17M worth of Apple and not blink (in Raw Profit Mode). I would not call this a bug, but rather an undesirable side-effect of Fixed Dollar position sizing and Raw Profit mode.

I was looking for a way to improve the accuracy of the product, and of course, my confidence in the product.
Maybe in Raw Profit Mode the product should peek with appropriate warnings in the excellently written manuals.

Thanks for your time and consideration.
profile picture

Eugene

#11
We truly appreciate your desire to improve the product, Dave.

IMHO it could be an enhancement if Wealth-Lab acted like a broker and rejected the trade in RP mode.
profile picture

Cone

#12
QUOTE:
I have not found a foolproof way to limit this in real-time trading.
You can set limits on order sizes at IB.

QUOTE:
it is easy to make an error in calculating a Stop Price
Really I can't imagine that kind of an error, but even if it occurred due to a data spike, it would take only a couple lines of code to determine if your stop price is within a reasonable estimate of price.

Indeed we're far from a slippage discussion now. Please start a new topic and suggest a requirement. I'm really afraid that what you're suggesting is just adding complexity behind the scenes that would add confusion when testing order types.