Menu

Paper Trading PHP Script

Forex Trading Platform


A paper trading PHP script simulates a virtual stock or crypto exchange. It lets users practice buying and selling assets with virtual funds using real-time or simulated market data. Building this involves a front-end UI, a backend to manage virtual balances, and a connection to a financial API. A paper trading system using real-time data to simulate trading competitions on the stock market. PHP 8.0+, No Database Required, No Encryption, No Domain Restrictions, Single-Use Commercial License.

Paper Trading PHP Script

Coderobotics Paper Trading PHP Script is a complete, self-hosted paper trading simulator built in pure PHP 8.0 with no framework and no database required. It automatically discovers backtested trading strategies by combining 40+ technical indicator conditions — including RSI, MACD, EMA, Bollinger Bands, and Stochastic — and validates each one across three non-overlapping data windows (In-Sample, Out-of-Sample, and Holdout), surfacing only the strategies that beat buy-and-hold on all three. Users can then practice trading those strategies with a $10,000 virtual portfolio, executing simulated buys and sells at real-time prices pulled from Yahoo Finance, tracking open positions and P&L, and reviewing a full trade history — all without risking a single dollar. 

An integrated Google Gemini 2.0 Flash AI engine explains each passing strategy in plain English, and a Chart.js-powered candlestick chart with consensus BUY / SELL / HOLD signal rounds out the dashboard. The full PHP source code is delivered with no encryption, no domain restrictions, and a single-use commercial license — making it an ideal white-label foundation for anyone looking to launch a practice trading website, trading education platform, or stock market simulator. 

STATS

  • 40+ Technical Indicator Conditions
  • 3 Backtest Validation Windows
  • $10,000 Virtual Starting Capital
  • 100% Open Source Code

WHAT'S INCLUDED

  • AI Strategy Generator Automatically discovers trading strategies by randomly combining technical indicator conditions and validating them across 3 non-overlapping data windows. Only strategies that beat buy-and-hold on all 3 windows are surfaced.
  • Real-Time Market Data Fetches OHLCV daily data from Yahoo Finance (free, no key needed) with automatic fallback to Alpha Vantage. Live price bar shows open, high, low, volume, and 1-year performance for any ticker.
  • Paper Trading Portfolio Starts with $10,000 virtual cash. Users can buy and sell any ticker, track open positions with weighted average entry price, and view P&L in dollars and percent per trade. Full trade history log included. Reset to $10,000 at any time.
  • 3-Window Backtesting Every strategy is validated across In-Sample (60%), Out-of-Sample (20%), and Holdout (20%) windows. Only strategies passing all three are displayed — dramatically reducing overfitting and false signals.
  • AI-Powered Strategy Explanations Click any strategy's Explain button for a Gemini 2.0 Flash plain-English breakdown of why a strategy works, what conditions it uses, and market regimes where it may succeed or fail.
  • Interactive Charts Chart.js-powered candlestick and line charts render inline for any ticker. A signal card shows the consensus BUY / SELL / HOLD derived from all passing strategies.
  • CSV Export Download all passing strategies as a CSV file for further analysis in Excel, Python, or any spreadsheet tool. Strategy returns, win rates, and scores all included.
  • Security Built-In CSRF protection, bcrypt password hashing, and .htaccess rules to block direct web access to the data directory are included out of the box.
  • Fully Configurable Change starting cash, fee rate, minimum trade count, entry/exit condition counts, and default data source — all from a single config.php file. No deep code edits required.

HOW IT WORKS

Step 1 — Data Fetch OHLCV daily data is pulled from Yahoo Finance (free, no key). Falls back to Alpha Vantage if Yahoo is unavailable. Supports custom CSV uploads as a third data source.

Step 2 — Indicator Calculation RSI, MACD, EMA, Bollinger Bands, Stochastic, ATR, ROC, Volume, and Candlestick Patterns are calculated across the full OHLCV history.

Step 3 — Strategy Assembly The engine randomly picks 2 entry + 1 exit condition from a library of 40+ boolean signals — crossovers, threshold breaks, and pattern detections — and assembles a testable strategy.

Step 4 — 3-Window Validation Each strategy is backtested using long-only, next-candle-open entries and exits with a 0.1% fee per trade. Only strategies beating buy-and-hold across all 3 windows are shown.

Step 5 — Paper Trade Users execute simulated buys and sells at the latest fetched price. Portfolio state is persisted to a local JSON file and can be reset to $10,000 at any time.

TECHNICAL INDICATORS INCLUDED

  • RSI — Relative Strength Index
  • MACD — Moving Average Convergence Divergence
  • EMA — Exponential Moving Average
  • Bollinger Bands — Volatility Bands
  • Stochastic Oscillator — Momentum Signal
  • ATR — Average True Range
  • ROC — Rate of Change
  • Volume Analysis — Volume-Based Conditions
  • Candlestick Patterns — Pattern Detection

API INTEGRATIONS — ALL FREE

ServicePurposeFree TierKey Required?
Yahoo FinancePrimary market dataUnlimitedNo key needed
Alpha VantageFallback market data25 req/dayOptional
Google Gemini 2.0 FlashAI strategy explanations1,500 req/dayOptional

All three integrations used by this script are available on a free tier. No paid subscriptions required for your customers.

REQUIREMENTS

  • PHP 8.0 or higher
  • Web server: Apache or Nginx (or PHP built-in server for local development)
  • No database required
  • No PHP extensions required beyond standard curl / file_get_contents
  • No framework — pure PHP

CUSTOMIZATION

  • Change starting cash: Edit portfolio_initial_cash in config.php
  • Change fee rate: Edit fee_rate in config.php
  • Change min trades filter: Edit min_trades in config.php
  • Add more conditions: Add to ConditionLibrary.php and register in getEntryNames() / getExitNames()
  • Change entry/exit count: Edit entry_condition_count / exit_condition_count in config.php
  • Change default data source: Edit data_source in config.php (yahoo, stooq, or alphavantage)

FAQ

Does this script require a database? 
No database is required. Portfolio state is stored in a local JSON file (data/portfolio.json). Market data is fetched live from Yahoo Finance. Installation is extremely simple — upload the files, configure your API keys, and you're live.

Can I use this with real money or live trading? 
No. This script is designed exclusively for paper trading — simulated practice with virtual funds. It is a research and educational tool and does not connect to any brokerage or execute real trades.

Are there any recurring API costs? 
All three integrated APIs offer free tiers that cover typical usage. Yahoo Finance requires no API key at all. Google Gemini's free tier allows 1,500 requests per day, which is more than sufficient for most deployments.

Is this a white-label script I can use commercially? 
Yes. The script is sold under a single-use commercial license with no domain restrictions and no encryption. You receive complete PHP source code that you can modify, brand, and deploy as you see fit, per the Coderobotics license terms.

Can I add my own technical indicators or trading conditions? 
Yes. New boolean conditions can be added directly to ConditionLibrary.php and registered in the getEntryNames() / getExitNames() methods. The architecture is designed to make extensions straightforward.

How do I get access to the live demo? 
Click Request Demo & Pricing Details on this page, fill in your email address, and we will send you live demo credentials and pricing within one business day.

License
A regular license permits the use of an item in a single project, whether for personal or commercial purposes, by you or on behalf of a client. Resale of the item, either individually or as part of a project, is prohibited, and the distribution of source files is not allowed.

Hosting Requirements
Compatible with Apache module, PHP 8.2 or above, on Windows or Linux servers. (Note. For seamless our script performance, compatibility at a low price, we highly recommend Hostinger—reliable, fast, and built for excellence!)

Server Requirements

  • PHP 8.0 or higher 
  • Web server: Apache or Nginx (or PHP built-in server for local development) 
  • No database required 
  • No PHP extensions required beyond standard curl / file_get_contents 
  • No framework — pure PHP

Payment Type
One time Payment: Upon receiving your full payment, we will provide you with the complete source code. After that, no additional payments will be required.

Delivery Time
We will send the Download Link to you Within 2-4 hrs. On Working Days(Monday- Friday) And the source code will deliver within 4-8 hours On Weekends (Saturday -Sunday).

Technical Support
Unlimited Email Support for One Year.

Script Update
Free Updates for One Year.

Customization Scope
Includes Complete Source Code.

Encryption
No Encryption and No Domain Limitations.

Installation
No Free Installation Services. Our charges range from $5 to $10, depending on the software's complexity and criticality.

Comments


No comments yet. Be the first to comment!

Related Software Lists