ошибка в данном блоке осталась
// Long entry
long_entry_condition = long_entry and close < tp1
if (long_entry_condition)
strategy.entry("Long Entry", strategy.long)
strategy.exit("TP 1 Long", "Long Entry", limit=tp1)
strategy.exit("SL Long", "Long Entry", stop=sl)