I created a very simple "rotational" strategy
It outputs expected results for WealthLab's S&P100 data set, something like:
But if I run it on my dataset, then I get the following output:
In other words the "number" variable get's re-intialized. Plus the dates are processed in a chaotic order.
Why does it happen? What am I doint wrong?
Thank you!
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using System.Collections.Generic; namespace WealthScript7 { public class HighestIndicatorInSectorRotation : UserStrategyBase { int number = 0; public override void PreExecute(DateTime dt, List<BarHistory> participants) { WriteToDebugLog(number++); var myStock = participants[0]; int idx = GetCurrentIndex(myStock); WriteToDebugLog(myStock.DateTimes[idx]); } public override void Execute(BarHistory bars, int idx) { } } }
It outputs expected results for WealthLab's S&P100 data set, something like:
CODE:
---Symbol by Symbol Debug Logs--- ---JPM--- 0 10.03.2020 0:00:00 1 11.03.2020 0:00:00 2 12.03.2020 0:00:00 3 13.03.2020 0:00:00 .... 1253 05.03.2025 0:00:00 1254 06.03.2025 0:00:00 1255 07.03.2025 0:00:00
But if I run it on my dataset, then I get the following output:
CODE:
---Symbol by Symbol Debug Logs--- ---[TICKER 1 THAT STARTS ON 18.08.23]--- 0 18.08.2023 0:00:00 1 21.08.2023 0:00:00 2 22.08.2023 0:00:00 3 23.08.2023 0:00:00 4 24.08.2023 0:00:00 ... 04.03.2025 0:00:00 394 05.03.2025 0:00:00 395 06.03.2025 0:00:00 396 07.03.2025 0:00:00 ---[TICKER 2 THAT STARTS ON 13.04.17]--- 0 10.03.2020 0:00:00 1 11.03.2020 0:00:00 2 12.03.2020 0:00:00 ... 14.08.2023 0:00:00 848 15.08.2023 0:00:00 849 16.08.2023 0:00:00 850 17.08.2023 0:00:00 ---[TICKER 3 THAT STARTS ON 13.04.17]--- 0 24.03.2022 0:00:00 1 25.03.2022 0:00:00 ---[TICKER 4 THAT STARTS ON 13.04.17]--- 0 07.01.2022 0:00:00 ---[TICKER THAT STARTS ON 06.04.17]--- 0 21.03.2022 0:00:00 1 22.03.2022 0:00:00 2 23.03.2022 0:00:00
In other words the "number" variable get's re-intialized. Plus the dates are processed in a chaotic order.
Why does it happen? What am I doint wrong?
Thank you!
Rename
WriteToDebug organizes the output grouped by symbol unless you pass false as the second parameter.
Tip!
Click on any keyword in the Editor to see this information in the QuickRef.
If for some reason that doesn't work (maybe you're programming in Visual Studio) or you can't remember this exact method name, use the Search the QuickRef... button for any term.
Click on any keyword in the Editor to see this information in the QuickRef.
If for some reason that doesn't work (maybe you're programming in Visual Studio) or you can't remember this exact method name, use the Search the QuickRef... button for any term.
Everything works fine now with the "false" specified as the second parameter.
Thank you for the suggestion! I have the panel with QuickRef in the left area of the Wealth-Lab and always read the description. I also tried to find the answer in the Discussions prior to writing this ticket.
The main problem - I didn't realize that it was a simple problem with the text output, I thought of something more sophisticated: problems with mutlithreading, or corrupt datasource.
I should have used the KISS aproach :)
Thanks again Colleagues, an outstanding product indeed!
Thank you for the suggestion! I have the panel with QuickRef in the left area of the Wealth-Lab and always read the description. I also tried to find the answer in the Discussions prior to writing this ticket.
The main problem - I didn't realize that it was a simple problem with the text output, I thought of something more sophisticated: problems with mutlithreading, or corrupt datasource.
I should have used the KISS aproach :)
Thanks again Colleagues, an outstanding product indeed!
Your Response
Post
Edit Post
Login is required