Hey,

I am creating a hybrid framework algorithm and so far it works as expected until I try to add a limit order as a take profit.

I get trades seeemingly out of nowhere, such as this:

 

1/6/2023 13:15NQ16M23Buy MarketFill: $11,148.75 USD4Filled1 Month1/6/2023 13:15NQ16M23Sell LimitFill: $12,261.00 USD-4FilledTake Profit Limit: $12,261.00 USD

 

Where at the same candle prices of the same symbol differ 10%. And get quite a lot of these cases.

I am attaching the code. Let me know if you can spot the mistake. Thank you.