So I want to delay buy orders after a stop loss for a certain period of time.
Its all contained in onbarupdate. The stop loss and buy/sell is in a if else statement. I use position.avg price and close to compare to stop loss. Then nested if statement of barssinceexit() > 100
{ p = 0}.
I have double p variable and set p = position.avg price after some sell order.
So once barssincexit is true it makes/resets the stop loss to false and goes to else to buy/sell.
It works for the first stock but others not. Is the p variable not resetting every time and to each stock? P is not acting like a variable and for each stock. I've played with it and nothing works for the other stocks.
Thanks,
Comment