S T O C K G A M E P R O

Order-Flow Simulator

Advanced Trading Logic

Deep Dive into Order Flow, Indicators, and Strategy Design

Quick Start Overview

Stock Game Pro is a market‑microstructure simulator where every candle is produced by order‑book depletion. The price does not move randomly; it moves because bids or asks are consumed. This gives you a clean environment to learn how real price discovery works.

Core loop: order‑book pressure → price tick → candle update → indicator update → strategy decision.

Goal: train your eye to link the flow (orders) to the response (price + indicators).

Platform Strengths (Detailed)

Order‑Driven Candles

Every candle is built from simulated market buys/sells depleting the order book. This shows why price moves rather than just the result.

Real‑Time Indicators

Indicators (RSI, MACD, VWAP, BB, ATR, ADX, MFI, etc.) update on each tick, so you see their true behavior during live price formation.

Custom Indicator Coding

Write your own formulas and render them directly on the chart. This is ideal for testing ideas quickly without external tools.

Auto‑Trading Sandbox

Test entry/exit logic with advanced helper functions (market, limit, stop, sizing, cooldowns). You can iterate safely and observe results immediately.

Learning benefit: You can isolate one skill at a time—trend reading, momentum timing, volatility control, and execution precision—then combine them into a complete strategy.

Why it matters: Most charts only show outcomes. This simulator shows causes, which is exactly what you need to improve decision‑making.

0. The Philosophy

Scalping is more than just fast trading; it is the process of understanding Market Microstructure. This simulator demonstrates how raw order book data is transformed into candles and technical indicators in real-time.

Why this simulator is different: You are not just watching random candles. Every tick is born from order book depletion, so you can see why price moves, not just that it moves.

Key strengths: practice reading liquidity shifts, test strategies with real‑time indicators, and build your own indicators and automated rules without external tools.

Workflow: How to Use the Simulator

Step 1 — Read the Order Book

Watch bids/asks: thick levels act like magnets or barriers. When a level is fully consumed, price ticks to the next level.

Step 2 — Confirm with Indicators

Use trend indicators (SMA/EMA/VWAP) for direction, momentum indicators (RSI/MACD/Stoch) for timing, and volatility (ATR/BB) for risk.

Step 3 — Execute with Rules

Test manual or automated rules. Use limit orders for better fills, stop orders for protection, and helper functions for sizing.

Step 4 — Review and Iterate

After each run, check the trade log and indicator behavior. Adjust one rule at a time so you can see exactly what improved or worsened your results.

1. Order Book & Price Discovery

BUY Pressure

When market buy orders consume the entire liquidity at the Best Ask, price ticks upward to the next level.

SELL Pressure

When market sell orders deplete the Best Bid, price ticks downward to find new buyers.

Benefit: You learn how bids and asks absorb orders and why breakouts or reversals happen at specific price levels. This builds intuition that classic charts alone can’t teach.

Execution & Order Types (Practical)

Market Orders

Instant execution at the current price. Use when speed is more important than price.

Limit Orders

Reserved orders that only fill if price crosses your limit. Use for precise entries and exits.

Stop / Stop‑Limit Orders

Protective orders that trigger when price crosses a level. Stop‑limit adds price control after the trigger.

Sizing Helpers

Use orderQty to read the UI quantity, setOrderQty to change it, and riskQty to size by risk. This keeps your execution consistent and prevents accidental oversizing.

2. Technical Indicators (Deep Dive)

The indicators below are mathematical re-renderings of the trade data generated in the order book. Use overlays to guide trend direction, oscillators to gauge momentum, and volume tools to confirm participation.

SMA (Simple Moving Average)

SMA smooths price by averaging the last N closes. It shows the underlying trend and common support/resistance zones.

SMA = (Sum of last N closes) / N

EMA (Exponential Moving Average)

EMA weights recent prices more heavily, reacting faster to new order flow than SMA.

EMA = Price * k + EMA(prev) * (1 - k)

Bollinger Bands (BB)

BB measure volatility around a moving average. Expanding bands = rising volatility; contracting bands = compression.

Upper/Lower = SMA ± (Std Dev * 2)

VWAP (Volume-Weighted Average Price)

VWAP blends price and volume to show the average price where most volume traded.

VWAP = (Sum of Price * Volume) / (Sum of Volume)

Relative Strength Index (RSI)

RSI is a momentum indicator that measures the magnitude of recent price changes to evaluate overbought or oversold conditions.

RSI = 100 - [100 / (1 + (Average Gain / Average Loss))]

MACD (Moving Average Convergence Divergence)

MACD measures trend strength by comparing fast and slow EMAs, then smoothing with a signal line.

MACD = 12 EMA - 26 EMA
Signal = 9 EMA of MACD
Histogram = MACD - Signal

Stochastic Oscillator

Stochastic compares the current close to the recent high-low range to detect momentum shifts.

%K = (Close - Low) / (High - Low) * 100

CCI (Commodity Channel Index)

CCI measures deviation from a moving average using typical price to spot cyclic turns.

CCI = (TP - SMA) / (0.015 * Mean Deviation)

ADX (Average Directional Index)

ADX shows trend strength, regardless of direction. Higher values mean stronger, more directional moves.

ADX rises as directional movement dominates noise

ATR (Average True Range)

ATR measures volatility by tracking the average true range of recent candles.

ATR = EMA(True Range)

MFI (Money Flow Index)

MFI blends price and volume to measure buying vs selling pressure.

MFI = 100 - [100 / (1 + Positive MF / Negative MF)]

ROC (Rate of Change)

ROC measures speed of price change over a set period.

ROC = (Close - Close N) / Close N * 100

Williams %R

Williams %R is a momentum oscillator scaled between -100 and 0, similar to Stochastic.

%R = (Highest High - Close) / (Highest High - Lowest Low) * -100

Volume Bars

Volume bars show how much participation occurred during each candle.

Volume = Sum of executed size during the candle

OBV (On-Balance Volume)

OBV accumulates volume based on price direction, revealing whether volume supports the trend.

OBV = Prior OBV ± Volume (based on price up/down)

3. Auxiliary Indicators & Helper Signals

These are secondary metrics available in the custom indicator and auto-trade engines. They are not plotted by default but are powerful for filtering, confirmation, and risk control.

RSI 7 / 21 + RSI Slope

Fast and slow RSI versions plus the direction of RSI change. Use rsi7 for quick turns, rsi21 for trend context, and rsiSlope to detect momentum acceleration.

ATR 7 / 21 + ATR%

Short and long volatility baselines. atrPct expresses ATR as a % of price, useful for dynamic sizing and setting realistic targets.

MA Differentials & Slopes

smaDiff, emaDiff, ema10Slope, and sma20Slope capture spread and acceleration between averages. Great for early trend shifts.

MACD Signal + Histogram

In addition to MACD line, you can monitor macdSignal and macdHist to confirm whether momentum is building or fading.

Stochastic %D

The smoothed line (stochD) helps filter noisy %K spikes. Crosses of %K and %D often precede micro reversals.

Bollinger Width & %B

bbWidth measures squeeze/expansion, while bbPctB shows where price sits inside the bands (0 to 1).

Volume Structure

volSma5/20/50, volRel, and volChangePct quantify whether current volume is above normal and how fast it is changing.

Trend Flags

priceAboveSma20, priceAboveEma20, closeAboveVwap, and trendUp provide quick regime checks for filters and stop logic.

4. Auto-Trading Order Size Controls

The auto-trading engine can read and control the UI order size directly. This lets you size trades dynamically without hard-coding a quantity.

orderQty, setOrderQty(qty), buyOrderQty(), sellOrderQty()
if (orderQty > 0 && rsi14 < 30) { buyOrderQty(); }

5. The Scalper's Edge

Pro Tip: Combine Indicators with the Order Book

6. Strategy Design Checklist

Entry Criteria

Define: trend filter, trigger signal, and confirmation. Example: EMA trend + RSI dip + rising bids.

Exit Criteria

Define: profit target, stop, and invalidation. Example: sell at VWAP touch or stop below last swing.

Risk & Size

Use fixed size, percent of equity, or risk‑based sizing. Keep consistency and avoid oversized positions.

Execution Discipline

Only take trades when all conditions align. If a condition fails, skip the entry. Discipline protects the account more than any single indicator.

For more detailed explanations, please visit the Guide page.
RETURN TO TERMINAL