Firstly, I realise that it's not a great idea to create an algorithm with just one indicator, but I'm using this as practice to get to know the API and Python a bit better. I'd also appreciate any general advice that you might have regarding the way my algorithm is built - i've tried to base it on similar things i've found.

So lets say I want to use an RSI indicator to select a stock to buy and hold for 5 days, then sell. I should find the range of RSI values that correspond to the most gain. I can think of two ways to do this and I have questions about both.

  1. Use the built-in optimisation functions. I could take the three parameters (RSI minimum, RSI maximum and RSI window length) and vary them all with the optimisation function. I've read that this costs money to do, but I can't find any information regarding the pricing. Do i have to be concerned that I might accidentally end up paying a large amount? Can I limit my potential spending here?


2. Buy a large amount of stocks and see which go up and which go down and their corresponding RSI values at the time of purchase. In other words - Run a backtest for a few years and plot the gain/loss of a trade on one axis and the RSI at time of purchase on the other axis. Any help turning what i've submitted below into something like i've described would be appreciated. I can't figure out how I would do something like this.

Many thanks,