I am trying to do the following: Buy everyday if I don't have a position. I want to exit if my opening price is greater than my entry price or I have 2.5% loss. The transactions coming out does not look right. What am I doing wrong ? I am guessing my limit order
order_target(context.security,0,style=LimitOrder(op), exchange=IBExchange.SMART))
or my use of return is not correct ?