Pathfinder Trading System
Forums › ProRealTime English forum › ProOrder support › Pathfinder Trading System
- This topic has 1,834 replies, 139 voices, and was last updated 1 year ago by CFD AutoTrading.
Tagged: Pathfinder
-
-
01/09/2018 at 12:03 PM #5856601/09/2018 at 12:10 PM #5856701/09/2018 at 12:23 PM #58576
It looks like there is an issue with the trendmultiplier. It is not working properly or not at all. If you change that to 1 in the code it is shut off and the trades look more or less what has happened in live trading. But with the multiplier to 1 it is still in postion. As attached:
So you think that the trend multiplier is not working in live but is working in demo if I understand right.
01/09/2018 at 12:25 PM #5857701/09/2018 at 12:49 PM #58583Oh dear…. it seems we have another case of backtest not matching reality. Is reality more profitable though – if so that could be a PRT first!
This backtest of v8 can never match reality completely. The first reason is that the spread is set to 2 points, which is incorrect for most of the day, and the second reason is that there is no correction for slippage.
Look at the exit of today’s 8 contracts : They were closed at 9:00 due to line 297 in the code, because posprofit (defined in line 287) was positive at this time and the maximum number of candles with profit exceeded (lines 51, 290 and 296).
When the spread is set to 2, posprofit at 9:00 according to the backtest was only 10,60 € for all 8 contracts. Now imagine, that due to slippage (entry prices a little worse than in the backtest), posprofit in reality may have been slightly negative, say for example, -1,30 €. Could have well occured and would have prevented the closure of the 8 contracts at 9:00, because maxCandlesLongWithoutProfit = 75.
When you want backtest results to match reality almost completely, you need to build in a correction for this and other types of slippage in the code. The backtest calculates with the candles’ close or open +- spread as entry and exit prices, and there must be a correction so that the live trading system does this too. Normally, a live trading system calculates with the actual entry or exit prices (not close and open) and they may be slightly different from the candles because of slippage.
Also, the spread should be adjusted to the actual values at different times of the day in the code, when you want a better match between backtest and reality.
01/09/2018 at 1:02 PM #5858501/09/2018 at 1:02 PM #58586Very good analysis Verdi55.
Do you have an example of code that you add to your strategies to adjust the spread throughout the day and on different days of the weeks? It shouldn’t be too hard to write but if someone else has done and was willing to share it it could give us all a few hours ofour lives back to do something else.
Even if the spread settings do not exactly match the live market closer it better than nothing at all for improved accuracy.
On a separate note – I’m not keen on strategies that exit after a certain number of bars if in profit or otherwise. There is a huge potential for curve fitting with ideas like that. For the same reason I hate strategies that sell up everything and go flat at certain times. If you are in a trade either stick with it or get out if it is going wrong – not just because a certain time has arrived.
01/09/2018 at 1:08 PM #58588On a separate note – I’m not keen on strategies that exit after a certain number of bars if in profit or otherwise. There is a huge potential for curve fitting with ideas like that. For the same reason I hate strategies that sell up everything and go flat at certain times. If you are in a trade either stick with it or get out if it is going wrong – not just because a certain time has arrived.
Absolutely. A fixed time generates just a perfect fit for the backtest. I take supertrend cuts, for example, as exit signals. Then a sideward movement may run as long as wants to.
I will see what I have in my code drawer as slippage correction.
01/09/2018 at 1:11 PM #5858901/09/2018 at 1:21 PM #58591@verdi55, The spread is set to 2 is actually more than it is. From 09.00 to 17.30 it is 1 and after that it is 2 until 22.00 hours. According to the code Dax 1H V8 is trading between 09.00 and 22.00 hours. kind regards,
But that is the problem. A wide spread will stop us repeatedly tripping into buy and sells whereas a narrow spread will trigger events more often. So a backtest on a fixed 2 pip spread will perform very differently to a live run on varying spread. This does not explain why PRTdemo live is different to PRTcomplete live as surely both use the same live data feed? Or do they?
A good exercise is to put the Bid Ask Colour Band indicator onto a short time frame graph and just watch how much the spread changes over a time period to see how spread can change from second to second.
01/09/2018 at 1:28 PM #5859201/09/2018 at 1:38 PM #58598Yes that is true that if you put the band on the screen you see it change from second to second. But it is not always in your disadvantage. I sometimes even see for moments no spread at all.
But the discussion was not that we had differences in the slippage and spreads, but differences in times when V8 went long and with how many positions. That showed a discrepancy caused by
the trendmultiplier from my point of view.
01/09/2018 at 1:39 PM #5859901/09/2018 at 1:41 PM #5860001/09/2018 at 1:58 PM #58606Do you have an example of code that you add to your strategies to adjust the spread throughout the day and on different days of the weeks?
Here is a little code for correction of spread and slippage issues :
spread and slippage correction123456789101112// each buy or sellshort order occuring LATER in the code is labelled with "entered = 1"// the code remembers a theoretical "backtest" entry price 1 bar after a position has been openedIf entered = 1 and longonmarket thenposopen = open + 0.5endifIf entered = 1 and shortonmarket thenposopen = open - 0.5endifentered = 0I add this code at the top of a trading system, before all buy or sellshort orders occur. Then, I calculate the return of a position not with positionprice or positionperf, but with posopen, which is the theoretical positionprice from the backtest.
0.5 is half of the normal DAX spread from 9:00-17:30 h, and it should be set to different values at different times of the day. 0.5 points from 9:00-17:30, 2.5 points overnight, 1 point for the rest.
When you calculate the theoretical backtest return of a position, you need to add the real spread to the “close” values, too.
Return of a long position from 9:00-17:30 is then :
(close – 0.5) – posopen,
not “pprice * positionperf”
So when you say : “close a position when its return exceeds or falls below a certain value at the end of a bar”, backtest and reality will match more frequently when you apply this correction.
Keep in mind that anything that can cause differences between reality and backtest due to spread and slippage (for example the total return “strategyprofit”) may make the real system behave differently than the backtest. So you may want to include this correction for all commands that refer to actual entry and exit prices and to the return of a position or strategy. This may be quite some work.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on