Login Page - Create Account

Support Board


Date/Time: Tue, 08 Oct 2024 19:20:54 +0000



Post From: Backtest positions does not correlate with trade result and sc.GetTradePosition

[2024-08-27 15:41:15]
PS - Posts: 37
I apologize, I think there is still some confusion. There are a total of 5 "sources" I'm using to validate the backtest trades.

1) literal arrow drawings I'm creating via the chart drawing capabilities in the backtest
2) printed trade result (trade result = 1) of each trade
3) Printed current position using sc.GetTradePosition
4) buy / sell orders shown on chart via the Show Order Fills setting
5) trade activity log

Sources 1-3 all show the "correct" trades being taken. That is, the backtest working as it should.

Sources 4 and 5 show entirely different, incorrect orders.

Let me share an example with pictures.

The first trade in the backtest should be taken on 8/5 at 16:30 (15m chart). I've attached 3 images. My message log, the picture of the chart, and the trade activity log.

In the message log, you'll see that a message printed saying buy conditions were met, and the trade result printed as 1 (successful). The current position 5 minutes later also shows long 1 contract.

In the chart image, you'll see a light blue arrow at the time the trade was SUPPOSED to be taken. However, you'll also see the green triangle much later on at a different price displayed by the show orders / fills setting.

Lastly, in the trade activity log, you will see no trade taken on 8/5 at 16:30.
imagesc trade activity log.jpg / V - Attached On 2024-08-27 15:40:28 UTC - Size: 283.64 KB - 27 views
imagesc message log.jpg / V - Attached On 2024-08-27 15:40:44 UTC - Size: 239.85 KB - 32 views
imagesc arrow.jpg / V - Attached On 2024-08-27 15:40:52 UTC - Size: 99.41 KB - 31 views