I'm new to this whole algorithmic trading. I would like to create an algorithm that buys GPRO when the current price is above the 15 day moving average. The algorithm would sell all of the shares if the current price crosses below the 15 day moving average. The algorithm would short GPRO when the 15 day moving average crosses below the 60 day moving average. I am not quite sure how to code this. I have tried many times to no avail. Thanks for the advice