Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with Forex Trading Using Python

You're reading from  Getting Started with Forex Trading Using Python

Product type Book
Published in Mar 2023
Publisher Packt
ISBN-13 9781804616857
Pages 384 pages
Edition 1st Edition
Languages
Author (1):
Alex Krishtop Alex Krishtop
Profile icon Alex Krishtop

Table of Contents (21) Chapters

Preface Part 1: Introduction to FX Trading Strategy Development
Chapter 1: Developing Trading Strategies – Why They Are Different Chapter 2: Using Python for Trading Strategies Chapter 3: FX Market Overview from a Developer's Standpoint Part 2: General Architecture of a Trading Application and A Detailed Study of Its Components
Chapter 4: Trading Application: What’s Inside? Chapter 5: Retrieving and Handling Market Data with Python Chapter 6: Basics of Fundamental Analysis and Its Possible Use in FX Trading Chapter 7: Technical Analysis and Its Implementation in Python Chapter 8: Data Visualization in FX Trading with Python Part 3: Orders, Trading Strategies, and Their Performance
Chapter 9: Trading Strategies and Their Core Elements Chapter 10: Types of Orders and Their Simulation in Python Chapter 11: Backtesting and Theoretical Performance Part 4: Strategies, Performance Analysis, and Vistas
Chapter 12: Sample Strategy – Trend-Following Chapter 13: To Trade or Not to Trade – Performance Analysis Chapter 14: Where to Go Now? Index Other Books You May Enjoy

Making actual trading decisions – trading logic and credit risk

In directional trading, systemic risks are mostly realized when you or your trading strategy supposed the price would go in one direction, but in reality, it went in the opposite direction. Don’t worry, this situation is absolutely normal for systematic trading, and no one can guarantee that any strategy will generate a win rate of 100%.

There are two major types of trading strategies: data-driven and event-driven. Data-driven strategies analyze the price time series (which we discussed in the Retrieving market data – quality and consistency as keys to success section) in order to find a certain pattern or sequence that then triggers an order. Event-driven strategies wait for a certain event to happen – for example, a new tick at a certain price and with a certain volume, or a release of political news or economic indicators. In both cases, a trading app should have rules to not only open positions but also to liquidate them – again, based on price data or events (or both).

In general, if a strategy generates some wins and some losses, there are only two ways for it to make money:

  • Generate more wins than losses
  • Have the average win greater than the average loss

If your trading algorithm does not have a routine that handles situations when the market goes against the position, then most likely, the average loss across a statistically significant number of trades will be greater than the average win, and it will become really problematic to make money with such a strategy.

Don’t forget that forex is traded using leverage, which means the ability to trade much greater amounts of money than you actually have in your account. In the case that your trading algorithm has poor risk management logic and incorrect position sizing, an open position may quickly drain your account to zero if the price goes the opposite way, and even worse – some brokers will even let you go negative and you will be left with debt instead of profit.

Key takeaway

Systemic risk management and position sizing algorithms are crucial parts of an algo trading application.

Systemic risk is very important, but there’s good news for systematic traders: it is possible to mitigate this risk by carefully testing the strategy before going to production and adjusting it so the systemic risk is minimized. But there is one more risk that is hard to mitigate during the research and development phase: transactional risk.

You have been reading a chapter from
Getting Started with Forex Trading Using Python
Published in: Mar 2023 Publisher: Packt ISBN-13: 9781804616857
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}