I've created my first strategy, and while backtesting it I've noticed that I get impossible results. For example, my strategy loses thousands of dollars each and every day, such that my equity curve goes straight down. If I do nothing to the algo but swap the buy and sell signals, it generates the exact same number of trades but loses almost the same amount of money in the same way.

This is obviously impossible behavior. What might be wrong with my code that would generate this issue?

Thanks!