Difference between a buy and a short

Hello! I am a beginner in trading, and had an idea for a trading bot that buys and sells very quickly, within minutes. I set it up to buy stocks, and found that it lost money on almost every single buy it made for a few days in a row. It averaged to about -1.5% a day, pretty consistently.
According to my understanding, a short is just buying -1 stocks, so I decided to change it so every time it would buy, it would short instead. So I kept the same stocks as one of my test days, and changed the code to short instead of buy. In theory, this would change my -1.5% a day to 1.5% a day, which is pretty good. However, theory and practice are not the same, and I still saw the -1% a day drop even though I was shorting.
Am I understanding shorts incorrectly? What are some differences between shorts and buying that I should be aware of? Is what Iā€™m trying to do even possible?

The negative profit you are making with your bot has nothing to do with buying versus shorting positions and more to do with the fact that sells lower than priced paid when you bought the position, or buy higher than price when you sold the position.

For buying / selling the goal is to buy lower than selling price. Shorting is selling a position you dont have, betting that the price will drop so you can then buy it and make a profit because you sold it already before at a higher price.

Some of the slippage is due to the bid-ask spread. Assuming you are placing market orders, a buy order should fill at the highest open offer (ask) price in the market. The opposite is true for sell orders. There is pretty much always a spread between the bid and ask. If you were to buy a stock and then immediate sell if before the pirce changes, you will lose money. You will lose an amount equal to this spread. If you have an algorithm buy and sell many many times, you will lose the spread multiplied by the number of transactions. The therortical profits of your algorithm may not exceed the cost (spread) of the transactions.

1 Like