Regarding trade execution and real price range
Author: akuzn
Creation Date: 1/26/2014 6:27 AM
profile picture

akuzn

#1
After have compared BuyAtLimit, ShortAtLimit WealthLab style to alternative trades execution (real bar + 1 and real price range on bar + 1) half of winning trades became loosing. I ve realised "parallel verification of trades for backtesting". Not always and not in all strategies but sometimes this additional test annoyes a lot.

Could you please explain - WealthLab uses Close[bar] for these orders instead of any other price i pass to these methods? If yes what is the purpose of passing any price to these methods?

What could you suggest to avoid this and use more realistic prices?
Normally price must be from bar+1 range.

Unfortunately i am asking it again - didnt find anything useful in ref
profile picture

Eugene

#2
As I already replied to you before, the place to look for the basis price of an Alert is in the User Guide: Strategy Window > Backtesting Strategies > 100% of Equity Sizing > Basis Price.

A little refresher on how Wealth-Lab Strategy is processed:

1. A complete bar updates
2. Your strategy executes over all the bars in the chart and determines if there's an Alert to trade on the next bar.

Normally, Wealth-Lab uses the price on the "bar" for the position sizing because the data for bar+1 is not available yet at this moment of time. The execution price can be found in the Actual Entry Price column, and of course it will take place on the bar of entry.

In the end, it's not clear to me what your problem is. If you're looking for additional realism when simulating Limit/Stop-based systems using EOD data, check this out: Setting Priority for AtStop/AtLimit Orders. Otherwise please rephrase and clarify.
profile picture

akuzn

#3
OK.
Im asking because didnt get answer.
Real example.
30200,30210...
In the code threre is call
CODE:
Please log in to see this code.

WealthLab as i understand will execute order in backtest mode, but in reality it wont be never executed.
Because there is time computing in intraday, some time losses if srategy monitor is used etc.
It is not important for EOD trading but such behavior is much more unfair for EOD.

Cant understand how priority settings will help me.
Is there only one way - to realize my own backtesting?
profile picture

Eugene

#4
What these two numbers are meant to illustrate?

How is "Turn off limit/stop order rounding entirely" configured in Preferences > Backtest settings?
profile picture

akuzn

#5
Close[bar] = 30200;
Close[bar+1] = 30210;
On [bar] there is signal: Buy,
Ok later in the code we call BuyAtLimit (bar+1, Close[bar]+Tick); Would prefere use 0.2* StdDev[bar] instead of tick but doesnt matter now.
if tick is less than 10 order want be executed. But it backtest it executes).

There is nothing in this box. Box is unchecked in backtest preferences
profile picture

Eugene

#6
As can be seen in the manual, the Close price is not considered when making an AtLimit decision. It's either the Limit price itself or Open price, whichever is lower.
profile picture

Cone

#7
In other words, if the Open of the bar is below the Limit trigger price, the signal executes at the Open price. Otherwise, the Low of bar must be equal to or below the Limit price for the trade to trigger. Slippage settings will alter the behavior a bit, as described in the User Guide.
profile picture

akuzn

#8
OK. One more try. Thank you - i ll check it again.

Why i am asking - i have realised code "overriding wealthlab orders execution".
This code gives sometimes absolultely different results - i mean half or trades may not be even realised or price may not be the same as in wealthlab.
Certainly such list of trades cant be analyzed under scorecards etc but i wanted to have alternative "point of view". What is important in this overriding - if i input there execution at [bar] prices level - result is similar to wealthlab, if [bar+1] prices result may be significally other.
profile picture

Cone

#9
Limit orders guarantee that you get the limit price or better (never worse). So it's certainly possible that actual executions don't match reality, but at the worst, they will be exactly at the limit price.

Limit trades executed in Wealth-Lab with 0 slippage, may not occur in live trading. That's what the limit slippage setting is for. However, if you apply limit order slippage in backtesting, the opposite could happen as well... the live trade occurs because ticks were executed precisely at the limit, whereas Wealth-Lab won't execute the trade since the setting requires that it ticks beyond the limit price to execute.

The only way to practically guarantee that live trading stays in synch with the theoretical test is to turn your limit orders to market orders when the limit price is hit. This is what the Quotes tool "Convert to Market" feature is for.

--- Edit ---
Of course I should have mentioned data is all-important too. [Especially around Sept 2008] data spikes in daily bars will trigger theoretical trades that would have never occurred in reality. The only solution is to use "correct" data. By virtue of using a different DataSet (intraday) I believe the SetTimeOfDayPriority method identifies trades in the Debug Window that could not have occurred. You can use that information to manually correct the daily bars in question.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).