Home arrow PHP arrow Building an E-mini Trading System Using PHP and Advanced MySQL Queries

Building an E-mini Trading System Using PHP and Advanced MySQL Queries

This article shows illustrative examples of how PHP and some advanced MySQL queries can be used to build an online trading system. For simplicity, we will be featuring one of the most common stock indexes: the S&P 500 index.

  1. Building an E-mini Trading System Using PHP and Advanced MySQL Queries
  2. Implementation, steps 1 through 5
  3. Implementation, steps 6 through 13
  4. Implementation, steps 14 and 15
By: Codex-M
Rating: starstarstarstarstar / 4
November 10, 2009

print this article



This is also called E-mini S&P 500 futures, one of the most commonly traded equities/futures.

The Design

As of September 2009, there was no currently working trading system on the Internet powered by PHP and MySQL despite the platform's popularity among open source communities.

A trading system is used to enter and exit a trade in a stock or futures market. Although in exiting a trade to grab profits and control losses, money management  is a more useful tool than a trading system.

To create a fully working trading system, you need the following processes:

The raw data should be taken from a reputable source for S&P 500 index data. In this article, we will be using Yahoo! Finance data. The export file type is mostly .csv and Excel, so you first need to export the raw data to the MySQL database. (See details below)

The heart of the process is the trading system. It is a method for analyzing raw data and making judgments. Every trader has his or her own trading system to follow, but in this example, we will use the following rules:

Rule 1: Define Delta as the difference between “50 days moving average “and “200 moving average.” If the delta is positive, it indicates a bullish trend, otherwise it's bearish. You can read more about moving averages.

Rule 2: Define % Strength of the trend as Delta/MA 200. This quantifies the strength of the trend. Apply historical data (define limits) for judgment (computation of limits is out of scope for this tutorial). This is more like a trend confirmation.

Use PHP to display the data in HTML tables while using MySQL advance queries (computing average and getting index data) to do some calculations of the moving average.

>>> More PHP Articles          >>> More By Codex-M

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: