Machine Learning and Pattern Recognition for Stocks and Forex Part 3 | Forex
Information | Currency | Markets | Fx | Video | Assets | Lesson | Trading
Welcome to the Machine Learning for Forex and Stock analysis and algorithmic trading tutorial series. In this series, you will be taught how to apply machine learning and pattern recognition principles to the field of stocks and forex. In this video, we are briefly taking a closer look into the bid-ask spread before diving into pattern recognition. This is especially useful for people interested in quantitative analysis and algo or high frequency trading. Even if you are not, the series will still be of great use to anyone interested in learning about machine learning and automatic pattern recognition, through a hands-on tutorial series. Sentdex.com Facebook.com/sentdex Twitter.com/sentdex
Comments
-
Hey Sentdex, I'm trying to replicate the above using iPython Notebook + pandas. Do you have any tips for that? Have you used pandas.Series or pandas.DataFrames to replicate any of your work?
-
Great tut (as all the others)! However, as soon as I add the ax1_2 lines, my dates on the x axis disappear. (they turn into 0.2 through 1.0 with .2 increments).
Hope this screenshot explains what I see: http://mixup.nl/example.png -
Did you set the minimum as 0?
-
Any idea why the 0.0000 for my Spread doesnt start at the bottom of the graph? It starts at -0.0002 , so there is a white gap on the graph at the bottom before the Spread starts. Thanks
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
graphRawFX()
File "C:\Users\Blue\Desktop\Mlstock\ml1.py", line 23, in graphRawFX
label.set_rotations(45)
AttributeError: 'Text' object has no attribute 'set_rotations'
My code:
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.dates as mdates
import numpy as np
def graphRawFX():
date,bid,ask= np.loadtxt("GBPUSD1d.txt",unpack = True,
delimiter = ",",
converters={0:mdates.strpdate2num("%Y%m%d%H%M%S")})
fig = plt.figure(figsize=(10,7))
ax1 = plt.subplot2grid((40,40),(0,0),rowspan=40, colspan = 40)
ax1.plot(date,bid)
ax1.plot(date,ask)
ax1.xaxis.set_major_formatter(mdates.DateFormatter("%Y-%m-%d %H:%M:%S"))
for label in ax1.xaxis.get_ticklabels():
label.set_rotations(45)
plt.gca().get_yaxis().get_major_formatter().set_useOffset(False)
plt.grid(True)
plt.show()