Hi, I am trying to buy stock using a market order, and then have a stop-loss using a stop market order if the price goes at or below a certain price. As I understand from this post:


a MarketOrder() using a positive number of shares followed by a StopMarketOrder() with a negative number of shares and a stop price below the current price, should be used. However, when I implement this in my code it seems to purchase the stock and then immediately sell the stock, despite the current price being above the stop price. Would someone know what the issue is? Thanks.