Why did Strategy take this trade?

I could certainly create an unlocked version where I can add print statements. I am currently using OnBarClose. I attempted to use ChatGPT to assist me with this issue and it created a code with OnEachTick, but it ended up taking multiple trades per single candle when I used it’s code in Playback, which I didn’t want. Also attempted to fix this, and it made a code that only triggered one condition per candle, and ultimately the results were worse than before. I’ll attempt print statements first, probably.