Replies: 3 comments
-
Just come by issue #119. I believe the comment made by @rokups makes things closer to reality. This issue popup when Entry, SL, or TP are close enough to trigger on the same bar - and which happens more often using high time frames. To add on these two comments:
I would go for a more pessimistic approach and assume that:
|
Beta Was this translation helpful? Give feedback.
-
question SL/TP hit on the same bar as trade opened refers to the same problem |
Beta Was this translation helpful? Give feedback.
-
Do you have code that triggers the issue? See #119 (comment). But in other regards, the framework's policy is already pessimistic, i.e. SL-first: backtesting.py/backtesting/backtesting.py Lines 1000 to 1011 in 0ce24d8 |
Beta Was this translation helpful? Give feedback.
-
When processing a new bar, how does Backtesting decide which price from High/Low comes first?
TradingView's Strategy Tester uses the closest price to the Open price to decide which one comes first. Strategies that use small triggers (small TP/SL), can cause significant inaccuracies in the results.
To illustrate the issue, let's say that my strategy has a Long position with a Stoploss at
10$
and a Takeprofit at20$
. A new bar comes, with an Open price of15$
, a High price of25$
, and a Low price of5$
. The High price triggers the TP, and the Low price triggers the SL. So depending on which tick comes first, it can change the result.Beta Was this translation helpful? Give feedback.
All reactions