Replies: 1 comment
-
Maybe the stoploss is too close to entry price. You can add some code to know the trades are triggered by what. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am backtesting a simple crossover with a penny stop loss strategy against 1 minute chart data. When I look through the trade results, I often see that the entry and exit bar are the same (which makes sense given the tight stop loss of only a penny from the previous bar's close price). However, when scanning the trade result data I do not see what triggered the trade (e.g. stop loss, cross over, etc.)? I'm using
output = bt.run() print(output['_trades'].to_string())
but that doesn't display what caused the trade to execute, which would be extremely helpful.Could someone also help me understand why cross over trigger trades do not happen right after the SL gets triggered? For example, if the entry and exit bar is on bar 10 then obviously the buy (or sell if shorting) order and stop loss occurred during the same bar - in this example bar 10. However, it's also possible that the crossover (I'm using StochRSI) occurred in bar 10 so I would expect a new order to fire on bar 11 but it doesn't execute until bar 12. I'm not sure my employer will allow me to copy/paste all the code but I'm sure I can paste snippets as needed.
Beta Was this translation helpful? Give feedback.
All reactions