As part of the Chartered Financial Data Scientist you are asked to propose a project and then research data, write Python scripts and present the data and findings.
Below is an example of how to generate signals and then show them in a graph. The code I used to generate the Buy Signal:
What I’ve done in the above code: Defined the default setting of the signal, it being zero, i.e. flat, at intialisation. (line 1) In the example above in line 2 I’ve scripted: Go back to neutral or flat when threefold standard deviation is below the Put Call Ratio value (this is just an example and not actually what I implemented). Then in the third line I’ve used the previously generated standard deviation of the Put Call Ratio and compared the threefold standard deviation to the respective Put Call Ratio. If it is larger then three times the standard deviation I have generated a buy signal, go long, or 1. Line 4 is the base signal of a buy and hold strategy, i.e. always 1, i.e. always long. That can be used for the backtesting phase as comparison.
The main point of this example being: 1) Show you how easy it is to visualise an index or stock price chart with a connected data series, such as the Put Call Ratio. You could also use moving averages or other data. 2) Visualise the trading signals below the actual index data and data series values. That makes it easier to understand whether a signal is working during different scenarios.
Questions or feedback?
Feel free to write me at firstname.lastname@example.org or add a comment.