-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error "Walk.forward()": Error in dividing dataset for "days" period? #90
Comments
[first Analysis]
Note: obv example one is created on a different |
[Analysis 2]
the dates behind the calculated Index are:
k.training are 36 months and k.testing are 12. All the Calculated periods here are 1 month short. I would like tp propose following sollution:
with following (new) code:
using this Code, the dates behind the calculated Index are:
|
… suggested by N0talent - see issue braverock#90 braverock#90
same problem here |
@ssh352 you need to give us more context, and an example, beyond 'same problem here'. Which version of the code are you running? Where is the reproducible example. It is not clear to me that this issue is real, and the proposed patch has conflicts with the trunk, and whitespace changes which make it very difficult to evaluate the patch. |
I'll provide a little more context. There are always going to be combinations of training and testing where the last training set could end on the last observation of the data, or there are not enough observations for a complete training or testing set. I do not believe that starting from -1 as an index solves this problem in a general way. I added changes in March 2019 to catch and correct for three more of these edge cases, but I won't be terribly surprised if I have still missed one or more edge cases. So if you are experiencing this problem, we need a parsimonious reproducible example, and a parsimonious patch or diagnosis to fix the problem. Otherwise, I can only fix things that I can demonstrate and test against. |
As a note, I am pretty sure other recent changes covered a variety of edge cases that I mentioned above, including the edge case mentioned by the original poster. I looked closely at the proposed changes, and added one that handles the endpoint of the training periods, which, as far as I can tell, is the only unresolved issue. Please test and report. Thanks! |
@braverock sorry for not providing more details. I sourced luxor.1 to luxor.8 in demo directory one by one. Two of them have errors: |
@ssh352 Thanks for the additional detail! That is really helpful. Could you try updating quantstrat to the current trunk please? I think I have fixed both issues that you show in your screen shots, so validating that would be a great service. |
@braverock So I updated quantstrat using devtools. I ran luxor.1 to 8 one by one. at luxor.3.paramset.sma.R, there is no error, but the result is suspicious, stats shouldn't be NULL at luxor.4.paramset.timespan.R, stats shouldn't be NULL I got the following errors at for the luxor.6 scripts. at luxor.8 there is a new error |
Could resolve #90 but needs to be tested
Need an alternative means for setting portfolios with unique names, as we dont have access to mktdata in this scope see #90
Establish a separate portfolio name for our test portfolio. Currently using first training portfolio which pollutes our first test portfolio transactions. See #90
Re-opening this as i am getting dubious results for Luxor as well, and we have identified issues with WFA when running for other non-demo portfolios. Depending on progress for those portfolios and whether the fix resolves Luxor remains to be seen. Nevertheless, we are actively looking into WFA. |
@jaymon0703 Guy Yollin has used quantstrat to demonstrate WFA, so it must have worked in previous versions before. Some new code must have caused regression. Will it help to add more unit and regression tests to quantstrat to catch such regression? Thank you! |
There is likely regression, although macdWFA runs to completion it still has a test portfolio that is polluted with training window transactions. @braverock is working on making the test portfolio unique which should resolve that and hopefully other issues. Tests would be great and pull requests are welcomed. Running the demos with Jenkins was floated as an option. |
If there is no return from the initializing parameter set, results$tradeStats can be empty. This will cause the rbind of subsequent param combos to fail, and lead to no results from the walk.forward or apply.paramsets call. Check for this case and use the current paramset combo instead. see #90
In the applyRules function, when evaluating rules we should reference first.index as opposed to the 1st timestamp. This fix is required for any strategy in which rule.subset is used, such as walk.forward. See #90
In the applyRules function, when evaluating rules we should reference first.index as opposed to the 1st timestamp. This fix is required for any strategy in which rule.subset is used, such as walk.forward. This is a material change in the behavior, so bumping version and updating 'Date'. See #90
Fixes bug for demo('luxor.8.walk.forward') when k.training=2 and k.testing=1. Also bump version. See #90
hi @ssh352 i am able to get results for all the luxor demos (incl the luxor.6 scripts) on version 0.15.6 except for the last one luxor.8.walk.forward which returns no results for the objective function. This is likely a symptom of too short a backtest. We will be adding more length to the GBPUSD dataset in due course. |
hi @ssh352 can you please re-test using version 0.16.1? if this is not an issue anymore, then we should close it. we have done a fair bit with walk.forward over the last few months...mainly for ensuring the test portfolio is not polluted with train transactions. our testing indicates everything is working as expected. |
@jaymon0703 Hi sorry must have missed the earlier reply. I sourced luxor.1 to luxor.8 in demo directory one by one. I only got an error on Luxor.8 |
Thanks @ssh352 i get the same error and suspect it has to do with the limited number of observations in the market data. I think for now we can leave the issue open until we increase the size of the market data, then re-test. Im confident all is in order as we have run a number of demos (macdWFA for example) and proprietary walk forward analyses in the last few weeks/months and the output seems sound. |
@jaymon0703 Hi macdWFA still has error, Please advise. |
Hmm I will check in a few hours.
…On Tue, 25 Jun 2019, 08:18 shenry, ***@***.***> wrote:
@jaymon0703 <https://github.com/jaymon0703> Hi macdWFA still has error,
Please advise.
[image: Screen Shot 2019-06-25 at 1 59 07 PM]
<https://user-images.githubusercontent.com/41779116/60073817-05b05500-9754-11e9-8f9d-e264d2755615.png>
[image: Screen Shot 2019-06-25 at 1 58 03 PM]
<https://user-images.githubusercontent.com/41779116/60073820-0648eb80-9754-11e9-99d7-bcbe05b91d3b.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#90?email_source=notifications&email_token=ABBDTPAK6X2E6EKHCKEYFC3P4G2DFA5CNFSM4FHMVCFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYPESEA#issuecomment-505301264>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABBDTPGCZYCQ52YNC5VWI73P4G2DFANCNFSM4FHMVCFA>
.
|
Very good...it is a script we test with and which would have passed, so i was surprised to see your error, although im unsure how a blotter update would have resolved it. Nevertheless, glad its working. Still on my todo list is to update the GBPUSD mktdata object to include more observations so we can properly test Luxor.8 and hopefully close this item... |
when i run the demo "/demo/luxor.8.walk.forward.R" i get following Error:
Error in
[.xts(symbol.data, testing.start.v) : subscript out of bounds
I looked into "walk.forward.R" and narrowed the "problem" down. I seemd to me as if walk.forward() is deviding the preiods wrong. In my case the Ending point of the is nrows(mktdata)+1
testing.start.v <- 1+training.end.v
I think here is the "problem" in row 141 in walk.forward.R
The text was updated successfully, but these errors were encountered: