Plotting price value and indicatiors and find the percentage of the time indicator is right and where it is wrong. How to program it ? method by which you can find accuracy of the indicator with a given price value.
To generate trading signals, you can use numpy.where method. For example, if the value of RSI is greater than 70 then, you can use where method and set buy signal and similarly for the sell signal.
To plot prices with signals generated from the indicator, you can use the plot() function of matplotlib.
You can try using these codes:
plt.plot(figsize=(10,5))
ax = prices.plot()
ax2 = signals.plot(secondary_y=True)
plt.show()
I am trying to find how many time RSI is giving true signals. How many false signals. To find the accuracy of RSI
Hello Manav,
You can do it with the following code:
percentage = len(np.where(df['RSI']>threshold))/len(df['RSI'])
where the numerator gives you all points in time when RSI is greater than a threshold. The denominator is total number of observations.