
Build a complete foundation for a robust forex trading and testing system with building blocks for data collection, historical data, web scraping, storage, and analysis.
Set up an Oanda demo forex trading account and enable api access to use the rest api for backtesting and automation. Generate and store your api key and account number.
Discover how forex trading works by exchanging euros and U.S. dollars, and profit from rate movements using leverage, buy and sell prices, pips, and spreads.
Set up the development environment by installing Python 3.6+, creating virtual environments, using Visual Studio Code with extensions, and using Postman for API requests.
Install Python 3.6 or newer on your system and learn how to run the interpreter across Windows, Linux, and macOS. Create a clean environment and avoid Anaconda, especially Windows 7.
Discover how Python virtual environments isolate project libraries, prevent version conflicts, and keep dependencies tidy. Learn to create and activate a virtual environment to manage dependencies within each project.
Learn how to create and manage a Python virtual environment on Windows, activate and deactivate it, install libraries with pip, and keep project dependencies isolated from the system Python.
Learn to create and activate Python virtual environments on Linux or macOS, install packages with pip, and manage paths and dependencies for forex trading projects.
Address the pip upgrade warning by upgrading pip with python -m pip install --upgrade pip, then verify by installing a library like Flask to ensure smooth installations.
Install Visual Studio Code and key extensions, set up a virtual environment, open the test folder with code, and select the proper Python interpreter for IntelliSense.
Master Postman to test API endpoints, organize requests in workspaces and collections, and simulate trading data for the complete algorithmic forex trading and back testing system course.
Discover how to access the Oanda rest api in the practice environment, authenticate with bearer tokens, and set json content-type while using the base url and endpoints to fetch data.
Learn how to call the accounts endpoint using Postman by configuring a workspace and a collection, setting bearer authorization and content-type json, and parsing a 200 response with account properties.
Navigate the account summary endpoint to fetch the account object and last transaction id with a get request using a required account id in the path.
Explore the account instruments endpoint to fetch all tradable instruments for a given account via a get request, returning the instruments list and the last transaction id.
Learn how to retrieve candlestick data using the instrument candles endpoint, configuring granularity, count, and from-to ranges, and interpreting open, high, low, close, and volume with UTC timestamps.
Fetch pricing data for specified instruments via the pricing endpoint and learn how price objects present time, bids, asks, tradability, and home currency conversions for live trading.
Begin by using Python to test endpoints, collect thousands of candles across currency pairs, and outline the main code structure for the complete forex trading and backtesting system.
Set up a Python virtual environment and VS Code workflow to run notebooks for forex data analysis, installing pandas, Jupyter, plotly, and requests, then create and run notebooks.
Set up a Python 3 virtual environment, install pandas and Jupyter, configure a Jupyter theme, create an exploration folder, start a notebook server, and run a simple API test notebook.
In a python notebook, set up a requests session with bearer api key and JSON content-type, build a ten candle eurodollar query, and parse the JSON response.
Learn how to fetch tradable instruments from the instruments API, select key fields, build a name-indexed dictionary, and save a curated instruments.json for backtesting.
Implement a flexible fetch candles function to query the api with configurable count, granularity, and instrument, return a status code and data tuple, and prepare candles for Pandas dataframe analysis.
Turn fetched candle data into a pandas dataframe by iterating over candles, filtering for complete ones, and extracting time, volume, and prices, with time parsed to datetime via dateutil parser.
Learn to build a candles dataframe from mid, bid, and ask prices, convert strings to floats, and create a reusable get candles dataframe function for backtesting.
Save every tradable currency pair by generating all instrument combinations from major currencies, fetch candles at h1 and h4, and store them as data files for backtesting.
Define an Oanda api class with a requests session and headers, loading api key, account id, and base url from a file, and highlight secret management.
Learn to add a self-contained make_request function to the api class that standardizes get requests, builds a full url, uses try-except for errors, and returns a (success, json) tuple.
See how to build a get request workflow in the OandaApi class, retrieve accounts data including summary and instruments, and validate responses for a forex trading system.
Create an in memory instrument class to store tradable data for backtesting and live bots, mapping API fields via from_api, converting margin rate to float and pip location, using underscore_type.
Build an instrument collection class in Python to load and store instruments from a JSON file, mapping each to an instrument object, with a singleton-like global instance.
Build and test a second instrument collection class that loads instruments from an API, saves to instrument start JSON, and validates by loading and printing the JSON data.
Plot candle charts in notebooks to evaluate strategies, then build a simple back test across multiple currency pairs and parameters, and save and reopen notebooks to assess results.
Learn to plot candlestick charts in notebooks with Plotly, load a dataframe, and build a candlestick trace using open, high, low, and close prices.
Learn to style a candlestick chart by adjusting line width, colors, margins, fonts, and grid lines, plus manage range breaks by converting times to strings for a clean, reusable plot.
Develop a reusable candle plotting utility for forex backtesting, enabling easy candlestick visualization in notebooks with a dedicated class, layout updates, and time-string handling.
Explore trading strategies and backtesting to build a versatile coding toolkit, learn to test across years and many currency pairs using indicators, and evaluate strategy effectiveness without bias.
Explore the moving average cross strategy using 10- and 20-period simple moving averages to signal buy and sell trades, and evaluate cross performance across thresholds.
Learn to compute and plot a ten-period moving average on a candle chart using pandas, including preparing a reduced dataframe, handling nan values, and resetting the index.
Plot the ten-period moving average on the candle chart using a scatter trace, with a clear line width, creating the moving average line alongside the candlestick plots.
Plot multiple moving averages using pandas in Python to visualize 10, 20, 50, 100, and 200 period trends on forex data and build line traces for rapid backtesting prep.
Detect delta sign changes to identify buy or sell trades by applying an is_trade function across the dataframe and creating a trade column for backtesting with moving averages.
Visualize forex strategy performance by plotting cumulative gains over time with line traces and candles, using pandas to compute gains and explore moving average crosses across pairs.
Move from notebooks to a Python script in Visual Studio Code to run moving average cross simulations across multiple currency pairs, using pandas and an instruments collection to load data.
Explore testing moving-average crossovers by pairing long and short moving averages, computing delta and prior delta, and applying a trade function to assess gains on forex pairs.
Calculate trades across multiple forex instruments by filtering non-null trades, computing pip gains per instrument, and returning total gain and trade counts for backtesting results.
Explore backtest results with a Result class that saves trade data to a data frame and provides a summary of trades, gains, and moving averages.
Integrate the main result class with existing code to return ETF trades and build the result object from trades, instrument name, and long and short moving averages.
Learn to convert backtest results into a pandas DataFrame by constructing a list of dictionaries, using list comprehension to extract results, and printing the dataframe for all forex pairs.
Save and accumulate all analysis results by appending data frames to a single pickle file, including granularity, instrument, and pair, for easy notebook loading and deeper trades analysis.
Archive trade data by saving dataframes to files, appending when they exist or creating new ones, with a defined data path for macro results and trades.
Examine one hour forex backtest results by grouping crosses, summing gains, and ranking by total gain to assess whether the moving average cross strategy is profitable, with spread considerations.
Evaluate cross strategies across currency pairs to gauge consistency. The BAC back test shows no strong cross and about half the pairs are profitable.
Analyze a cross-based forex backtest by sorting total gains, tracing cumulative gains over time, and comparing currency pairs with pandas plots, while preparing Excel exports for deeper review.
Build on prior test results by using Excel to quickly explore data with spreadsheets, charts, and tables, then automate the process to generate multi-sheet workbooks and well-formatted visuals.
Learn to export backtest data to Excel using the pandas dataframe and xlsxwriter engine, create a reusable create_excel function, and generate labeled tables and charts from simulation results.
Save backtest results to an xlsx workbook by preparing data, filtering by granularity, sorting by pair and total gain, removing time zones, and exporting per-pair sheets with moving average.
Export the cumulative gains for the best cross per forex pair and chart them in Excel by building a table from the dataframe and selecting the top row per pair.
Create a line chart of cumulative gains in Excel via Python, mapping start and end rows, categories and data columns, and customizing the chart title and legend.
Learn to build an algorithmic forex trading and back testing system that tests moving average cross strategies, saves results to Excel, and uses Python with pandas to extend candles data.
Collect candlestick data with Python scripting across many instruments and finer granularity, spanning six years. Rerun the moving average cross simulation to evaluate performance changes.
Update the OandaApi integration to fetch candles using date range or count, format dates with a T and Z for UTC, and return the candles for backtesting.
Load candles dataframes from the Oanda API by fetching candles with keyword arguments, including the pen name and a date range, and validate by checking for empty dataframes.
Define a python data collection script using pandas and date time and dateutil, handling api candle limits by chunking date ranges and saving dataframe of five minute and hour candles.
Implement a collection entry function that iterates euro and gbp pairs, builds instrument ids, and tests hourly data collection via collect_data with defined dates, paths, and an api.
Define date ranges and time steps to fetch candles across a span, handling end date and from date. Concatenate data frames and save the final file.
Fetch candles from an API with retry logic, build a candles dataframe, and verify 200 responses; test with m five candles and prepare to save historical data.
Collects and saves a cleaned, deduplicated dataframe of forex candles as a pickle file for backtesting, using a formatted file name with pair and granularity, and ensures time-ordered data.
Inspect the collected forex data across five-minute and hourly intervals, verify currency pairs and fields, and confirm the 2016 to 2021 date range before rerunning moving averages.
Run moving average cross simulations over six years of data, saving Excel results for the H1 and the H4 granularities, and analyze CAD/JPY, GBP/CAD, and NZD pairs.
Learn how to calculate popular forex indicators and how the RSI signals, and gain the skills to build your own indicators without libraries for reliable backtesting and live trading.
Learn how Bollinger bands use a 20-period moving average and standard deviations to form upper and lower bands, with signals from price crossing the bands using the typical price.
Implement Bollinger bands in Python with pandas by computing the typical price and rolling mean and std using n and s to produce upper and lower bands for forex trading.
Explore how to calculate the average true range (ATR) and apply it to the keltner channel, using the EMA, true range components, and secondary y-axis plotting for forex trading.
Explore how to implement Keltner channels using an exponential moving average and ATR, compute upper and lower bands, and integrate back testing for algorithmic forex trading.
Learn how the macd indicator uses the 12-26 ema difference and a 9-period signal line with a histogram to generate buy and sell signals, plus backtesting notes for forex trading.
Explore candle patterns in forex trading by examining single and multi-candle formations, understand how patterns hint market direction, and practice coding candle pattern detection without libraries.
learn to compute candle characteristics in Python: determine direction, body size, full range, and body percentage using pandas, and visualize with candle plots.
Compute candle characteristics by deriving body bottom and top percentages from candle ranges, normalize to the full range, and store results in a dataframe for later pattern identification.
Translate candle characteristics from notebook to a Python script, defining a patterns module that applies candle props and patterns to a dataframe using pandas, with VS Code workflow and testing.
Learn to identify hanging man and hammer candlestick patterns in a forex backtesting workflow, using body-size and position criteria to detect reversals and plot results in a notebook.
Explore the inverted hammer candlestick pattern and its reversal signals in forex trading, including how to detect shooting star setups and implement pattern checks in a notebook.
Identify the spinning top candlestick, signaling indecision, by enforcing a 40–60% body range and a 15% body size constraint across candles.
Explore the mariposa single candlestick pattern, defined by a near full-body candle (roughly 98-99%), and learn how to implement a lambda-based check to detect it in a forex backtesting workflow.
Explore how engulfing candles signal trend reversals in the dual candlestick pattern, distinguishing bullish and bearish cases, comparing body sizes, and excluding gapping.
Master tweezer top and tweezer bottom candlestick patterns in algorithmic forex trading, detecting two candles with similar highs and lows and bodies in the lower half, green-red or red-green.
Explore the morning star and evening star multi-candlestick patterns and implement their detection with midpoints, body percentages, and pandas dataframes for automated backtesting in forex trading.
Convert notebook candle pattern logic into a script, extend the dataframe with pattern fields, implement set candle patterns, test detection (engulfing, morning/evening star, mariposa), and prepare for deeper simulations.
Whilst fun, Forex trading is not easy! To be successful today, you must have the ability to test strategies, automate trading and access information.
IMPORTANT:
Note: For this course, we will use the Oanda API service. It is available in most countries worldwide, however please check before purchasing the course. You can check in video #3 called "Oanda account setup and API access". If you are in the EU, it's not available.
Whether it's as a hobby or professional, this course will give you the foundation upon which you will be able to:
Build a live trading bot
Create a fast, accurate strategy testing system
Retrieve live headlines, sentiments, technicals and more from the web.
Use databases to store and correlate data with market moves
Build a web application showing the latest prices, sentiments and other market data
Learn full stack development, using MongoDB, Python and JavaScript (with React)
We will start by learning to use Python to access the Oanda REST API. Next, we'll download a few thousand candles and develop a simple strategy back test, testing multiple parameters and currency pairs at once. We'll use the results from this back test to learn how to automate the export of results into a spreadsheet format with tables and graphs.
Once the simple strategy has been tested, we'll get hold of a lot more data - six years' worth for multiple time frames. We'll rerun our simple strategy, and then move on to implementing candle pattern detection and indicator calculation. We will also look at using multi-processing to speed up the testing even more.
Now we have some more knowledge, it's time to create a more comprehensive back testing system - with spread and breaking candles down into finer time frames. For testing we will choose two strategies with over a million views on YouTube and assess whether they really give the claimed 90% win rate...
It's now time to move on to the big moment - the live trading bot. We will develop a robust trading bot that trades multiple pairs with comprehensive logging. We will structure the code such that it is easy to swap in and out strategies.
Now it's time to get more advanced and learn how stream prices live - using multi-threading with events and work queues to react to prices and make decisions
We will learn how to use Web Scraping with Python to access live sentiments, technicals, headlines and economic data. Alongside this, we'll create a MongoDB database to store our data.
Next up: React! We will use the famous framework to develop ourselves a web application that can access live prices, our sentiment data and much more.
Finally, we will deploy our trading bot on a cloud service.
The course includes a quick-start appendix for Python and for HTML/CSS/JavaScript.