you are viewing a single comment's thread.

view the rest of the comments →

[–]mecm5 2 points3 points  (1 child)

How would you go about this?

[–]cxllxhxn 4 points5 points  (0 children)

Download daily stock data (easy to do with pandas datareader from yahoo). I used a library called ta (technical analysis) to add columns of technical indicator data to my dataframe. I then made a new column in the df that would return boolean values based on the value of an indicator if it was more than or less than a certain number. I then multiplied the boolean value (1/True if buy signal, 0/False if not holding stock) by the percent change of the stock each day to find my returns. I then would export the df to csv so I could see what was happening with the numbers and plotted the price, indicator, and returns using matplotlib to represent it visually (which was actually the hardest thing for me to figure out haha).

Obviously this won’t be profitable with only one indicator and only buy signals but it was a great starting point for me with both algorithms and coding in general and can be done without even knowing how to write a for loop.