[Python] ValueError: Long orders require: SL < LIMIT < TP

Discussão em 'Python' iniciado por Stack, Maio 18, 2025.

  1. Stack

    Stack Membro Participativo

    This error message appears when I run my code:

    [​IMG]

    I am writing code for a bot in Python, but when I run it, I get the ValueError exception. This is limiting me from increasing the take profit, which I don't need. I want to put a lesser value for the take profit, but it is not allowing me. Could anyone please help me solve this issue? Here is the code that I am writing:

    def support_trade_level(self, support, resistance, lower_support):
    if self.close <= support + self.buy_point1 and self.close >= support - self.buy_point2:
    self.buy(sl= support - self.slo_buy_point, tp= resistance - self.tp_buy_point)


    I know that increasing the take profit value will solve the problem, but that is a big issue for me. I need to solve it without increasing the take profit value.

    Also, could anyone help me understand why the take profit value I enter at the time of position opening is considered a LIMIT?

    Continue reading...

Compartilhe esta Página