Increasing Pattern Complexity: Machine Learning for Algorithmic Trading in Forex and Stocks

18.0K views
October 13, 2013
by
sentdex
YouTube video player
Increasing Pattern Complexity: Machine Learning for Algorithmic Trading in Forex and Stocks

TL;DR

Increase pattern complexity by expanding each pattern from 10 to 30 points, updating the related indexes and append operations, and making the percent-change formula safe when it encounters zero. The tutorial uses 0.000001 as a workable substitute for a zero result and reserves additional data for looking into the future. Read on for the exact code changes and how they prepare the algorithm for pattern recognition and backtesting.

Transcript

you hello and welcome to the 10th machine learning for use of Forex and stock algo trading automated trading or just plain analysis or just learning to do machine learning where we left off we were plotting up our similar patterns on a matplotlib so we can see them visually and we said that we actually wanted to do we extend our pattern lengths tha... Read More

Key Insights

  • 👻 Extending pattern lengths allows for improved analysis and visualization of data in machine learning for Forex and stock algo trading.
  • 🍵 Handling zero percent changes and negative infinity values is important to avoid errors in calculations.
  • 📈 Appending patterns helps expand the dataset for more accurate analysis and prediction of future trends.
  • 🖐️ Pattern recognition plays a crucial role in identifying matches and making informed trading decisions.
  • 🏃 Backtesting involves running through historical data to test the accuracy of the analysis and predictions.
  • 💗 As the dataset grows, the memory usage and processing time also increase, impacting the performance of the algorithm.
  • 🏛️ The video emphasizes the importance of building a backtester that simulates real-time trading scenarios.

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: How do you increase pattern complexity for machine learning in Forex and stock algorithmic trading?

Expand the pattern length from 10 points to 30 points, then update every related index, range, comparison, and append operation. The tutorial writes these changes out explicitly so the expanded pattern remains easy to follow.

Q: Why does the percent-change formula need special handling for zero?

A zero percentage change becomes problematic when the algorithm later calculates a percentage change from that zero. This issue becomes more likely as the program expands the pattern length and runs through all available patterns.

Q: What value replaces a zero percentage change in the formula?

When the calculated value equals 0.0, the function returns 0.000001. This is effectively close to zero while still giving later percentage-change calculations a workable number.

Q: How does the formula handle negative infinity or other calculation problems?

The revised logic is designed to avoid a negative-infinity result when calculating a percentage change of a percentage change involving zero. If another exception occurs, the function also returns a value near zero rather than allowing the calculation to fail.

Q: Which indexing values change when the pattern grows from 10 to 30 points?

The transcript changes the lookback from 10 to 30 and updates associated values such as 31. It also changes an earlier offset to minus 60 so the program can retain another 30 points for looking into the future.

Q: What must be updated after increasing the pattern length to 30 points?

All additional pattern values must be added wherever patterns are constructed, appended, compared, or recognized. The tutorial repeatedly extends the relevant sections through the new 11-to-30 range and checks the edits for mistakes.

Q: Why are the pattern updates written out manually instead of generated with a loop?

The presenter says these repeated changes should eventually be handled with a while loop based on the chosen pattern length. They are written out first because that approach is easier for viewers to follow, even though it is not the most efficient or Pythonic method.

Q: How does increasing pattern length prepare the algorithm for backtesting?

The algorithm will eventually run through historical patterns instead of examining only the ending pattern. Expanding the stored patterns and preserving future points prepares it to test pattern matches and predictions against later data in a backtester that simulates the trading process.

Summary & Key Takeaways

  • The video starts by explaining the need to extend pattern lengths for better analysis and visualization.

  • Changes are made to the formula to handle zero percent changes and negative infinity values.

  • The video also discusses the process of appending patterns and pattern recognition.


Read in Other Languages (beta)

Share This Summary 📚

Explore More Summaries from sentdex 📚