Tuesday, December 23, 2025

A Rule-Based Multi-Indicator Trading Strategy Built for Machine Learning

This post presents a rule-based forex trading strategy using Stochastic Oscillator, RSI, MACD, and EMA-200.
On its own, the strategy delivers around a 50% win/loss ratio (sometimes slightly less). That is intentional.

The real objective is not immediate profitability, but to collect large volumes of structured, labeled trading data that can be used to train machine learning (ML) and AI models capable of identifying higher-probability winning trades.


1. Strategy Philosophy: Rules as a Data Generator

Most trading systems are judged solely by win rate.
This one is judged by data quality.

The strategy is designed to:

  • Systematically trigger trades under clear, repeatable conditions

  • Capture both winning and losing outcomes

  • Cover as many market scenarios as possible

  • Produce balanced, unbiased datasets

A ~50% win rate is acceptable and even desirable at this stage, because:

  • It avoids skewed labels

  • It forces the ML model to learn real distinctions

  • It reduces overfitting risk

In ML-driven trading, coverage and consistency matter more than raw performance.


2. Why a 50% Strategy Is Valuable for ML

A rule-based strategy that wins half the time creates:

  • Clean decision boundaries

  • Equal exposure to success and failure

  • Honest representations of market behavior

This allows an ML/AI model to learn:

When does this setup work — and when should it be ignored?

With sufficient data and proper training, the model can learn to filter out low-quality trades and identify conditions with a higher probability of success.


3. Indicators Used

The strategy combines four core indicators, each modeling a different market dimension:

  • Stochastic Oscillator – entry timing

  • RSI – momentum bias

  • MACD – trend confirmation

  • EMA-200 – higher-timeframe trend filter

Each indicator is encoded as a discrete state, making the system deterministic, explainable, and ML-friendly.


4. Indicator Rules and State Encoding

A. Stochastic Oscillator (x)

SELL (x = 1):

  • %K > 80

  • %D > 80

  • %K crosses below %D

  • EMA-200 > Close Price

BUY (x = 2):

  • %K < 20

  • %D < 20

  • %K crosses above %D

  • EMA-200 < Close Price

Stochastic provides timing, not trend prediction.


B. RSI (y)

  • SELL bias (y = 1): RSI < 50

  • BUY bias (y = 2): RSI > 50

RSI defines momentum alignment.


C. MACD (z)

  • SELL (z = 1): MACD line crosses below Signal line

  • BUY (z = 2): MACD line crosses above Signal line

MACD confirms momentum transition.


5. Entry Logic: Controlled and Repeatable

Trades are entered only when all indicators align.

BUY Entry

x = 2 AND y = 2 AND z = 2

SELL Entry

x = 1 AND y = 1 AND z = 1

This strict confluence ensures clear trade intent and produces clean training samples.


6. Exit Logic: Outcome Labeling Over Optimization

Exits are not optimized for maximum profit.
They are designed for consistent, unambiguous outcome labeling.

Definitions

  • b → number of 5-minute candles after entry

  • a → trade direction (1 = sell, 2 = buy)

  • c / e → current profit or loss

  • k, j → counters for consecutive losses

Exits are triggered by:

  • Time in trade

  • Profit/loss behavior

  • Drawdown and loss-streak protection

This ensures:

  • Trades close within predictable windows

  • Outcomes are well defined

  • Labels remain reliable for ML training


7. The Role of ML / AI in This System

The rule-based layer:

  • Generates structure

  • Captures intent

  • Labels reality honestly

The ML/AI layer:

  • Learns patterns the rules cannot express

  • Identifies market contexts where the strategy performs better

  • Filters low-probability trades

  • Estimates win probability instead of blindly executing rules

When done properly — with enough data, correct labeling, and strict validation — an ML/AI model can learn to predict which trade setups are more likely to win, even if the underlying rule set itself has only a ~50% win rate.

The edge does not come from the rules alone.
It comes from the model’s ability to discriminate.


8. Final Thoughts

This strategy is intentionally imperfect.

Its purpose is to:

  • Be consistent, not clever

  • Capture every meaningful scenario

  • Produce massive, diverse datasets

  • Serve as a foundation for AI-driven decision making

A rule-based system that wins 50% of the time but records everything correctly is far more valuable than an over-optimized strategy that collapses outside backtests.

The rules collect the data.
The AI finds the edge.

No comments:

Post a Comment

A Rule-Based Multi-Indicator Trading Strategy Built for Machine Learning

This post presents a rule-based forex trading strategy using Stochastic Oscillator, RSI, MACD, and EMA-200 . On its own, the strategy deli...