Support Board
Date/Time: Fri, 22 Nov 2024 02:24:56 +0000
Post From: Backtest positions does not correlate with trade result and sc.GetTradePosition
[2024-08-24 16:01:24] |
PS - Posts: 40 |
Hello, I have a strategy I am backtesting whose orders (as per the order markings on the chart and the trade activity window) are not working correctly at all. To debug this, I did the following: 1) made my strategy draw arrows on the chart when buy and sell signals are generated 2) printed the trade result of every trade when it is placed 3) printed the current position using sc.GetTradePosition every 5 bars These 3 measures above all show trades being taken at the correct times. That is, arrows are drawn when and where they are supposed to, every single trade result printed = 1 and is at the correct price and time, and the sc.GetTradePosition data printed reflects what the strategy should be doing. However, despite these 3 checks being accurate, the actual positions shown by the Trade Activity Log are completely wrong and seemingly uncorrelated to my strategy. Any idea why this is occurring? Normally, I would think this is merely a problem on my end with my code, but since the 3 checks I mentioned above are working "right", I'm conflicted. |