MarketAlert – Real-Time Market & Crypto News, Analysis & AlertsMarketAlert – Real-Time Market & Crypto News, Analysis & Alerts
Font ResizerAa
  • Crypto News
    • Altcoins
    • Bitcoin
    • Blockchain
    • DeFi
    • Ethereum
    • NFTs
    • Press Releases
    • Latest News
  • Blockchain Technology
    • Blockchain Developments
    • Blockchain Security
    • Layer 2 Solutions
    • Smart Contracts
  • Interviews
    • Crypto Investor Interviews
    • Developer Interviews
    • Founder Interviews
    • Industry Leader Insights
  • Regulations & Policies
    • Country-Specific Regulations
    • Crypto Taxation
    • Global Regulations
    • Government Policies
  • Learn
    • Crypto for Beginners
    • DeFi Guides
    • NFT Guides
    • Staking Guides
    • Trading Strategies
  • Research & Analysis
    • Blockchain Research
    • Coin Research
    • DeFi Research
    • Market Analysis
    • Regulation Reports
Reading: Larry Williams Market Secrets (Part 9): Patterns to Profit
Share
Font ResizerAa
MarketAlert – Real-Time Market & Crypto News, Analysis & AlertsMarketAlert – Real-Time Market & Crypto News, Analysis & Alerts
Search
  • Crypto News
    • Altcoins
    • Bitcoin
    • Blockchain
    • DeFi
    • Ethereum
    • NFTs
    • Press Releases
    • Latest News
  • Blockchain Technology
    • Blockchain Developments
    • Blockchain Security
    • Layer 2 Solutions
    • Smart Contracts
  • Interviews
    • Crypto Investor Interviews
    • Developer Interviews
    • Founder Interviews
    • Industry Leader Insights
  • Regulations & Policies
    • Country-Specific Regulations
    • Crypto Taxation
    • Global Regulations
    • Government Policies
  • Learn
    • Crypto for Beginners
    • DeFi Guides
    • NFT Guides
    • Staking Guides
    • Trading Strategies
  • Research & Analysis
    • Blockchain Research
    • Coin Research
    • DeFi Research
    • Market Analysis
    • Regulation Reports
Have an existing account? Sign In
Follow US
© Market Alert News. All Rights Reserved.
  • bitcoinBitcoin(BTC)$77,916.004.30%
  • ethereumEthereum(ETH)$2,446.754.72%
  • tetherTether(USDT)$1.000.02%
  • rippleXRP(XRP)$1.494.02%
  • binancecoinBNB(BNB)$644.162.89%
  • usd-coinUSDC(USDC)$1.000.00%
  • solanaSolana(SOL)$90.164.06%
  • tronTRON(TRX)$0.325374-0.20%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.030.38%
  • dogecoinDogecoin(DOGE)$0.1009403.05%
Trading Strategies

Larry Williams Market Secrets (Part 9): Patterns to Profit

Last updated: February 2, 2026 11:30 pm
Published: 2 months ago
Share

Markets have always invited traders to search for meaning in price. Over the decades, countless chart patterns have been named, classified, and taught as if they carried universal predictive power. Head-and-shoulders, triangles, flags, and countless variations have shaped how many traders read charts.

Larry Williams challenges this tradition. He does not dismiss patterns entirely, but he questions their practical value when they are vague, subjective, and spread across long horizons. Classical formations often require interpretation, depend on hindsight, and unfold over periods where too many variables can interfere with the outcome. By the time a long-term pattern completes, the market environment may already have changed.

Instead, Larry Williams focuses on short-term price behavior. Short-term patterns form quickly, resolve quickly, and can be measured with precision. They are built from simple relationships between opens, closes, highs, and lows. They reflect immediate market emotion rather than long-term opinion. Most importantly, they can be tested objectively. This shift from visual storytelling to measurable behavior changes everything. When patterns are clearly defined, they can be transformed into rules. When rules are precise, they can be automated. When automation is possible, performance can be studied across thousands of trades rather than remembered from a handful of examples.

In this article, we begin that process. We take several of the short-term patterns introduced in his book, Long-term Secrets to Short-term Trading, and transform them into a research-driven Expert Advisor. Each pattern is implemented as an independent strategy. Each strategy can be tested in isolation. Each trade is managed using consistent risk and exit rules. The goal is not to prove that any single pattern is perfect, but to understand how structure, emotion, time, and volatility interact in real market data.

This article is part of a continuing series. Together, we are building a framework where ideas are not accepted by reputation alone, but evaluated by evidence, where trading concepts are not admired from charts alone, but measured through code, and where curiosity naturally leads to experimentation.

From theory to implementation, from patterns to profit, we now begin building a short-term pattern research engine in MQL5.

Why These Patterns Matter

Larry Williams did not search for complex formations. He looked for simple events that reflect short-term emotion and exhaustion. Each pattern described here forms quickly, resolves quickly, and can be measured without interpretation. That is exactly what makes them suitable for automation.

In this section, we describe the patterns that will be implemented in our Expert Advisor. Each one represents a different view of market behavior. Some follow momentum. Some trade against it. All of them can be tested objectively. We also apply the trade day of the week filter to every strategy. This allows us to study how the same pattern behaves across different days of the week.

Buying on the Open

Well, this does not qualify as a pattern, but it exists as a baseline of the experiment. At the start of each trading day, we place a buy order with no additional conditions. The stop loss is placed either at the low of the previous bar or at a distance derived from the previous bar range. The selected exit model determines the take profit.

This pattern does not attempt to predict direction. It simply measures whether the market shows a natural upward bias over time. It gives us a neutral reference point against which all other strategies can be compared. If more selective patterns outperform this simple rule, then the added logic is justified.

Buying After a Down Close

This pattern introduces the first emotional filter. We buy only when the previous day closed lower than it opened. The idea is simple. A single down close often reflects short-term selling pressure. In an uptrending market, this may represent nothing more than a brief pause. By buying after a down close, we attempt to enter during a minor pullback rather than at strength. The goal is to test whether mild weakness improves entry quality.

Buying After Three Consecutive Down Closes

This pattern deepens the same idea. Instead of a single down bar, we require several consecutive bearish bars. Larry Williams observed that short runs of selling often exhaust quickly. When three or more down closes appear in sequence, the market may already be near a short-term turning point.

Here, we buy only after a defined number of bearish bars. This pattern tests whether repeated weakness creates opportunity rather than danger.

Buying After an Objectively Measured Pullback

This is the most structured trend pattern. First, we confirm that the price is above the close of a bar far in the past. This establishes an uptrend. Next, we confirm that the price is below the close of a nearer bar. This defines a controlled pullback. When both conditions are satisfied, we buy at the next valid entry.

This pattern avoids visual judgment. Trend and pullback are measured using fixed reference bars. The logic remains consistent across all markets and all tests. It reflects one of Larry Williams’ most important ideas. Strong trends often reward those who buy weakness rather than strength.

Buying After a Bearish Outside Bar

This is a classic example of emotional exhaustion. An outside bar expands beyond the previous day’s high and low. When such a bar closes near its low, the market appears extremely bearish. Fear is visible on the chart. Most traders interpret this as a sell signal.

Larry Williams observed the opposite. In many cases, this pattern marks the end of panic rather than its beginning. When selling reaches an extreme, buyers often step in on the following day. Here we buy after a bearish outside bar with a close below the prior low.

This pattern directly tests whether extreme fear creates short-term opportunity.

Fading Three Consecutive Bullish Closes

This is the only short strategy in the group. We look for three consecutive bullish closes. Such sequences often attract late buyers. Strength becomes visible. Optimism increases. Instead of joining the move, we fade it. When price shows a loss of momentum and crosses below our entry level, we sell.

This pattern tests whether short-term strength often marks exhaustion rather than continuation.

Every pattern can be traded on all days or only on selected days. Larry Williams showed that many short-term patterns behave very differently across the week. Monday often reflects a reaction to weekend news. Friday often reflects a position reduction. Thursday frequently shows pressure before the close of the week. By enabling the trade day filter, we can measure how each strategy performs on specific days. This allows us to study not only price behavior, but also time behavior.

These patterns represent different forces. Some follow weakness within strength. Some fade emotion. Some trade continuation.Some trade exhaustion. By placing them within a single framework, using the same risk model and exit rules, we can compare them fairly.

The purpose is not to declare a winner. The purpose is to understand which ideas survive contact with historical data and which ones remain attractive only on paper. With the patterns defined, we now begin the technical construction of the Expert Advisor to test them with discipline and clarity.

A Single System with One Active Strategy

This Expert Advisor is designed as a unified trading system that can operate in several modes, but only one mode at a time. At launch, we select exactly one pattern from the available strategies. The selected pattern becomes the only source of signals until the EA is restarted or the configuration is changed. This approach allows us to test each idea independently and prevents interactions between unrelated logics.

Equally important, the system maintains only one open position at any given moment: no pyramiding, no hedging, no overlapping trades. Every new opportunity must wait until the previous position has been fully closed. This rule keeps the behavior simple, the statistics clean, and the interpretation of results reliable.

Entry Logic and Volatility-Based Confirmation

Except for the baseline strategy, all patterns rely on a volatility-based entry model. Once a valid pattern is detected on the completed bar, we do not enter immediately. Instead, we project an entry level using the simple volatility breakout technique. The range of the previous bar is measured and multiplied by a user-defined factor. This distance is added to or subtracted from the current open to produce the working entry price.

A position is opened only when the price crosses this projected level in the expected direction. This rule serves two purposes. First, it aligns the entry with short-term momentum. Second, it avoids entering during hesitation or low activity periods. The baseline strategy is the only exception. In that mode, we enter directly on the open without waiting for a breakout.

Configurable Stop Loss Placement

A stop-loss must protect every trade from the moment it is opened. We allow two placement models. In the first model, the stop-loss is set as a percentage of the previous bar’s range from the entry price. This creates a volatility-adjusted protective level that expands and contracts with market activity.

In the second model, the stop-loss is placed at the extreme of the previous bar. For long trades, this is the previous low. For short trades, this is the previous high. Both methods are objective, simple, and fully configurable. The chosen model applies uniformly across all strategies.

Flexible Profit Taking Models

Exit logic plays a central role in this system. We support three profit-taking modes. In the first mode, the position is closed on the first new bar open that shows a floating profit. This model’s fast reaction behavior reflects Larry Williams preference for quick exits.

In the second mode, the position is closed after a fixed number of completed bars. This allows us to study how long each pattern tends to remain effective.

In the third mode, the take profit is calculated using a fixed risk-to-reward ratio. The stop distance defines the risk. The reward distance is calculated as a multiple of that risk.

Only one exit model is active at a time. The selected model governs every trade regardless of strategy.

Trade Day Filtering

Every signal can be filtered by day of the week. We can allow trading on all days or restrict execution to selected days only. This rule applies before any trade is opened. This filter allows us to study time behavior independently of price behavior. The same pattern may perform very differently on different days. By isolating these effects, we gain insight into when a pattern is strongest and when it should be avoided.

Position Sizing and Risk Control

Position size can be defined in two ways. In manual mode, a fixed lot size is used for every trade. In automatic mode, the position size is calculated as a percentage of the account balance, based on the stop-loss distance. This keeps risk proportional and stable as equity changes.

This rule ensures that all strategies are tested under consistent risk conditions. Performance differences then reflect logic quality rather than position sizing artifacts.

Execution Discipline and Safety Rules

All price levels are recalculated only at the opening of each new bar. No trade is opened if any position from this EA is already active. All orders are tagged with a unique magic number to prevent interference with other systems. These safeguards prevent overtrading, conflicting signals, and unintended position stacking.

Every component is isolated, configurable, and testable.

With the rules now clearly defined, we can move forward to the technical construction of the Expert Advisor and translate these concepts into working MQL5 code.

In this section, we construct the initial framework of the Expert Advisor, define all configuration structures, and prepare the core objects and data containers that will later support every decision made by the program. This stage may appear simple, yet it is one of the most important phases of the entire project. A clear, well-organized foundation makes the strategy easier to understand, extend, and test in a controlled way.

Prerequisites for Following Along

To benefit fully from this section, a few basic skills are required. First, familiarity with the MQL5 language is essential. Core concepts such as variables, functions, conditional statements, loops, enumerations, and the use of standard libraries should already be comfortable. If these topics are still new, the official MQL5 reference is an excellent starting point before continuing further.

Second, prior experience with the MetaTrader platform is assumed. Navigation through charts, attaching Expert Advisors, and using the Strategy Tester should already be routine tasks.

Third, regular use of MetaEditor is required. Creating new source files, compiling code, reading compiler messages, and tracing simple errors should already be part of the normal workflow. With these conditions in place, we can now begin building the Expert Advisor step by step.

Working Alongside the Reference Implementation

Programming is best learned by writing code, not just by reading. For that reason, the completed source file for the Expert Advisor is attached to this article as lwPatternsToprofit.mq5.

Keeping this file open in a separate tab while following the tutorial allows direct comparison between each construction step and the final working system. This approach helps confirm understanding and prevents small mistakes from accumulating unnoticed.

Creating the Initial Source File

We begin by opening MetaEditor and creating a new empty Expert Advisor source file. The file may be given any preferred name. Into this file, we paste the initial boilerplate code shown below.

This code does not yet contain any strategy logic. Instead, it defines the structure that will later support all patterns, filters, and execution rules. Every section added here has a specific role in the system architecture.

Program Identity and Basic Properties

The opening lines define the program name, author information, and version number. These properties document the source file’s origin and enable the platform to identify the Expert Advisor during testing and execution. At this stage, no logic is introduced. We are simply establishing a formal identity for the program.

This library provides the CTrade class, which offers a reliable and consistent interface for opening and closing positions, modifying orders, and reading execution results.

Defining Strategy and Configuration Enumerations

We now introduce a set of enumerations that describe all selectable behaviors of the system.

The strategy enumeration lists every trading pattern that can be tested. Only one strategy will be active at any given time. This design allows each pattern to be tested independently and compared objectively. The stop-loss mode enumeration defines how protective exits are placed. The take profit mode enumeration defines how profits will be realized. The lot-size mode enumeration defines how position volume is calculated. The bar close state enumeration provides a clean way to classify candle direction. The trade day mode enumeration prepares the system for optional day-based filtering. These enumerations form the backbone of the configuration model. They transform trading ideas into structured states that the program can process systematically.

User Input Parameters and Strategy Controls

Next, we define all user-configurable input parameters. This section represents the public interface of the Expert Advisor. Every parameter declared here becomes visible in the platform and can be adjusted without modifying the source code. The strategy configuration group allows selecting the active pattern and fine-tuning pattern-specific values, such as the number of consecutive bars, the trend reference window, and the pullback reference window. The volatility breakout group controls how entry and stop distances are calculated based on the previous bar’s range. The trade day filter group defines which days of the week are permitted for execution. The trade and risk management group defines stop-loss and profit-taking logic, position-sizing rules, and risk exposure.

At this stage, we are not yet applying any logic. We are only describing the full control surface of the system that will later guide every trading decision.

Creating Core Trading Objects and Price Containers

We now create the CTrade object that will manage all trading operations.

This object becomes the single execution channel for opening and closing positions. Every order sent by the program will pass through this interface.

We then declare variables to store the current ask price, bid price, and current time.

These values will be refreshed on every tick and later serve as the base inputs for all price-based calculations.

Preparing the Volatility Level Structure

A central concept in this system is the projection of entry, stop, and target levels from recent market ranges. To manage these values cleanly, we define a structure that holds all volatility-derived price levels.

This structure stores the previous bar range, projected entry prices, projected stop prices, projected take profit prices, and measured stop distances.

By grouping these values into a single structure, related data remains organized and easy to maintain. Later calculations can update this structure once per bar, while entry and exit logic can read from it.

Preparing Intraday Price Tracking

We also declare an array to store the recent one-minute closing prices.

This array will later enable precise detection of crossover and crossunder events relative to projected entry levels. Without this array, entry signals would be delayed until the bar closes, losing their intended timing accuracy.

During initialization, the array is configured as a time series so that index zero always refers to the most recent price.

Initialization of the Expert Advisor

Inside the initialization function, we perform three essential actions. First, we assign a unique magic number to the trading object. This allows the program to identify later which positions belong to this specific Expert Advisor instance. Second, we reset the volatility level structure to zero. This guarantees that no uninitialized values are used when the first bar arrives. Third, we configure the price array as a time series. This ensures that price indexing remains consistent throughout the program.

At this point, the Expert Advisor is fully initialized but contains no trading intelligence. It is now ready to receive ticks and store market data safely.

Deinitialization and Program Shutdown

The deinitialization function performs a simple reporting task. When the program stops running, it prints the termination reason provided by the platform. This information is useful during testing to diagnose unexpected shutdowns or manual removals.

The Initial Tick Handler

The first version of the tick function performs only two tasks. It refreshes the current bid price, ask price, and current time. It copies the recent one-minute closing prices into the intraday array. No trading decisions have been made yet. No signals are evaluated. No orders are sent. This simplicity is intentional. Before introducing strategy logic, we first confirm that price data updates correctly, time is synchronized properly, and intraday arrays are filled without errors. Only after this foundation is stable do we begin layering pattern detection, filters, and execution rules.

At this stage, the Expert Advisor contains no trading logic, yet it already expresses the complete architecture of the system. We have defined all strategies, exit frameworks, filters, risk controls, and core data containers. Every future function will now attach naturally to an existing structure.

In the next section, we begin adding the first logical building blocks, starting with bar detection and basic pattern classification, and gradually transform this empty framework into a fully operational multi-strategy trading system.

With the foundation in place, we now begin shaping the Expert Advisor’s real intelligence. This phase introduces pattern recognition, volatility projection, trade timing, and the internal tools that enable the system to behave like a disciplined short-term trader.

At this stage, the goal is not yet to open trades, but to build a reliable environment in which valid opportunities can be detected, measured, filtered, and later executed with precision.

Why New Bar Detection Matters

Almost every important decision in this system begins when a new bar forms. At that instant, we want to achieve three objectives. First, we must project fresh volatility-based entry and exit levels from the previous bar. Second, we must update the internal counters used by time-based exits. Third, we must evaluate exit conditions before considering any new signals.

For this reason, the program needs a reliable way to detect when a new bar opens on the selected timeframe. We introduce a small utility function whose only role is to detect this event.

The function compares the current bar’s opening time with the previous bar’s stored opening time. When the two values differ, a new bar has formed. The third parameter is passed by reference so that the function can update the stored time internally. This avoids duplicate detection and ensures the logic runs only once per bar.

To support this mechanism, we define a global variable that stores the last bar opening time.

During initialization, it is set to zero so that the very first bar is detected correctly.

This single tool becomes the heartbeat of the entire system. Every volatility projection, bar counter update, and daily reset flows from this moment.

Tracking Consecutive Candle Closes

Two of the strategies depend on sequences of consecutive closes in the same direction. One looks for several bearish closes before buying. The other looks for several bullish closes before fading the move. Rather than duplicating this logic in multiple places, we define a general-purpose function that checks whether the last N completed bars all closed in the same direction.

The function starts from bar index one, which is the last fully closed bar. For each bar, it compares the close price with the open price. If any bar violates the required direction, the pattern fails immediately. If all bars satisfy the condition, the function confirms the sequence. This function converts a visual chart idea into an objective rule that the program can test without ambiguity.

Detecting a Uptrend With a Measured Pullback

Larry Williams proposed a simple and powerful way to define a pullback without subjective judgment. Two historical reference points are used. One bar confirms the broader trend by comparing today’s open with a close far in the past. Another bar confirms the pullback by comparing today’s open with a more recent close. If today is open is higher than the distant close, an uptrend exists. If today is open is lower than the nearest close, a pullback has occurred.

The function implementing this logic receives the lookback distances as parameters.

This makes the pattern fully configurable and suitable for testing across different market conditions. This approach removes opinion from the process. Trend and pullback are no longer visual guesses but strict price relationships.

Detecting Emotional Selling Through Outside Bars

Another important pattern described by Larry Williams is the bearish outside bar with a down close. This formation captures a moment of panic where price expands in both directions but closes near the low. The detection function enforces three conditions.

First, the current bar must exceed the previous bar at both the high and the low. Second, the close must fall below the previous low. Third, the bar must close below its open to confirm bearish pressure. Only when all three conditions are present does the function confirm the pattern. This transforms a visually complex bar formation into a precise mechanical rule.

Measuring Volatility From the Previous Bar

Every volatility projection in this system begins with a simple measurement. The high minus the low of the previous bar defines the working range. A helper function retrieves this range and normalizes it to the correct symbol precision.

This single value serves as the foundation for projecting entry, stop, and later take-profit levels. Without this measurement, the breakout model cannot function.

Projecting Entry Prices

Once the range is known, projecting entry prices becomes straightforward. For a bullish setup, the entry price is the current open plus a fraction of the previous range.

For a bearish setup, the entry price is the current open minus a fraction of the previous range.

The multipliers are user-configurable, allowing testing of how aggressive or conservative the breakout threshold should be. These projections define where momentum must prove itself before any trade is allowed.

Projecting Stop Loss Levels

Protective exits can be built in two different ways. In the volatility-based mode, the stop loss is projected from the entry price using a fraction of the same previous range. For bullish trades, the stop is placed below the entry.

For bearish trades, the stop is placed above the entry.

This keeps risk proportional to recent volatility and adapts naturally across markets and timeframes.

Projecting Take Profit Levels Using Risk to Reward

When the take profit mode is set to risk-to-reward, targets are derived directly from the measured stop distance. The distance between entry and stop becomes the unit of risk. This distance is multiplied by the selected reward ratio.

The result is added or subtracted from the entry to obtain the target price.

This approach guarantees consistent risk and reward geometry across all trades.

Detecting Level Crossings in Real Time

Signals in this system are not triggered by bar closes. They are triggered when the price actually crosses the projected entry level. To achieve this, we store recent one-minute closes and compare two consecutive values. A crossover occurs when the price moves from below a level to above it.

A crossunder is detected when the price moves from above a level to below it.

This allows the system to react immediately when momentum confirms the setup.

Filtering Trades by Day of the Week

Trade-day filtering is implemented using two small helper functions. The first converts the current time into a day index.

The second checks whether that day is enabled in the configuration.

This mechanism allows selective testing of patterns on specific days, which is central to the Trade Day Of The Week concept. The filter is optional. When disabled, all days are accepted.

Projecting Volatility Levels on New Bar Formation

With all tools ready, we now update the tick function so that volatility levels are projected only when a new bar forms. Inside the new block, we perform a strict sequence of actions.

First, the bar counter is updated if a position is active. Second, exit conditions are evaluated for the first profitable open mode. Third, the previous bar range is measured. Fourth, entry prices are projected depending on the selected strategy. Fifth, stop-loss prices are projected using the selected stop model. Sixth, projected take-profit prices are shown if the risk-to-reward mode is active. Finally, stop distances are computed for later position sizing.

This block resets the entire trading framework at the start of every bar. If a projected level is not breached during the bar, it is discarded and replaced on the next bar. No recurring signals are allowed.

Ensuring Only One Position Exists at Any Time

One of the core design rules is that only a single position may exist at any moment. Two helper functions scan all open positions and confirm whether a buy or sell position already exists for this Expert Advisor instance.

These checks are applied before every trade execution. If any position is found, no new trade is allowed. This rule keeps the system simple and prevents unintended position stacking.

Closing Positions Programmatically

When profit-taking modes do not use a fixed target, the system must close trades based on logic rather than price. A general closing function scans all open positions belonging to this Expert Advisor and closes them immediately.

This function is later reused for both time-based exits and first-profitable-open exits.

Calculating Automatic Position Size

When the lot size mode is automatic, position volume is derived from account risk.

The function computes the amount of money that may be risked based on the selected percentage. It then divides this amount by the product of contract size and stop distance. The result is a position volume that risks exactly the desired portion of the account. This keeps risk stable across different instruments and volatility regimes.

Executing Buy and Sell Orders

Two execution functions handle trade placement.

Before sending any order, the lot size is recalculated if automatic sizing is active. Orders are sent with the projected stop loss attached. If the exit mode is based on candle count, the bar counter is initialized immediately after entry.

Each function reports execution errors, allowing failures to be diagnosed during testing.

Managing Exits Without Fixed Targets

When a fixed price does not define the take profit, exits must be managed manually.

Two exit models are supported. In the first profitable open mode, the system scans open positions and closes them as soon as the floating profit becomes positive. In candle-based mode, the system closes the position when the bar counter exceeds the configured limit, then resets the counter. This function is called at precise points in the tick cycle to ensure exits are never missed.

Tracking Bars Elapsed Since Entry

Some exit models depend on time rather than price. For this reason, the system must keep track of how many completed bars have passed since a position was opened.

Inside the exit management logic, we refer to a variable named barsSinceEntry. This variable counts the number of bars that have elapsed since the current trade was placed and is used to decide when a position should be closed. We first define it at the global scope.

Before it can be used safely, it must be initialized during expert startup.

This counter will be incremented on every new bar after a trade is opened and reset once the position is closed. It becomes the reference for all-time-based exit decisions later in the system.

Assembling the Strategy Execution Logic

With all building blocks in place, we now assemble the trading logic in the tick function. Each strategy is isolated inside its own conditional block. The baseline strategy runs only on new bar formation because it enters immediately on the open.

All other strategies run continuously during the bar because their signals depend on price crossing projected levels.

Before any trade is executed, three conditions must always be satisfied. No active position exists. The selected pattern is valid. The Trade Day filter allows execution. Only when all conditions align is a trade sent. This structure allows each strategy to operate independently while sharing the same execution engine.

Placing Exit Logic at the Correct Time

Exit logic is evaluated in two places. On new bar formation, exits for the first profitable open mode are checked. On every tick, the candle-based mode’s exit conditions are checked.

This separation ensures that each exit model is evaluated at the correct frequency without unnecessary processing.

The chart appearance function removes the grid, selects candle mode, sets clear background and foreground colors, and assigns consistent candle colors. This creates a clean environment where price action and executed trades can be observed without distraction. The function is called during initialization so that the chart is configured immediately when the Expert Advisor starts.

At this point, the Expert Advisor is complete. Every pattern can be detected objectively. Every volatility level is projected consistently. Every trade is filtered, sized, executed, and exited by rule. Every strategy runs independently within the same framework. The system is now ready for testing.

Test Environment and Configuration

Before reviewing individual strategies, it is important to describe the environment under which all experiments were conducted. Every strategy was tested under the same controlled conditions to ensure comparable results. All tests were performed with the following settings:

This setup closely follows the spirit of Larry Williams’ original studies and provides a realistic trading environment.

Baseline Strategy: Buying on the Open

This first test represents the simplest possible model. A position opens at the start of each day and closes at the end of that day.

This result confirms an important point made in the book. When a market trends strongly, even a naive strategy can generate profit. Gold was broadly bullish in 2025. Buying every open allowed the system to benefit from this directional bias. However, the win rate remains close to random. Profit here comes mainly from market direction, not from pattern quality. This strategy establishes a useful reference level for all others.

This variation performs poorly. A single bearish day provides very little information about exhaustion or reversal. The low win rate shows that most pullbacks continue rather than reverse. This confirms that not all patterns deserve equal confidence.

Here, the picture changes dramatically. Three consecutive bearish closes represent emotional pressure and short-term exhaustion. The win rate rises sharply, and profitability improves. This supports one of Larry Williams’ key ideas. Patterns that represent extreme behavior offer a real advantage. Selectivity clearly improves performance.

This is the strongest performer in the entire study. The pattern combines two forces:

Trades are aligned with the main direction upon entry after a temporary weakness. Even though the sample size is small, the result demonstrates why this model is one of Larry Williams’ favorites. A trend plus pullback produces high-quality opportunities. This confirms that structure matters more than raw frequency.

No trades were triggered during the entire year. This result is as important as any profitable outcome. Larry Williams already warned that this pattern appears rarely. Testing confirms that scarcity is real. Rare patterns may be powerful, but they are unsuitable as standalone systems. They work best as filters or occasional opportunity models.

This strategy performs the worst of all. Attempting to fade strength in a bullish year leads to repeated failure. Momentum continues rather than reverses. This confirms a core principle. Counter-trend patterns are dangerous unless supported by a strong context. Without exhaustion or volatility filters, fading becomes a losing game. This test explains clearly why Larry Williams prefers trading with pressure, not against it.

Cross Strategy Observations

Several important conclusions emerge from these results.

Market Direction Matters

The baseline strategy performed well only because Gold was trending strongly. In a sideways or bearish year, the same model would likely fail. Patterns must always be evaluated within the market context.

Selectivity Improves Quality

As patterns become more selective, performance improves.

Filtering reduces trade frequency but increases trade quality. This supports the idea that fewer, better-structured trades produce better results.

Emotion-Based Patterns Work Better

The strongest patterns all represent emotional behavior.

These patterns capture short-term imbalance rather than visual shape. This confirms Larry Williams’ view that emotion drives short-term opportunity.

Fading Strength Is Dangerous

The losing strategy shows the risk of fading strong momentum. Without evidence of exhaustion, counter-trend trades fight market pressure. This explains why many reversal systems fail in trending environments.

What These Tests Teach Us

This study validates several of Larry Williams’ central ideas.

Most importantly, it shows that patterns must be tested, not assumed. Some ideas look powerful in theory, but disappear in real data. Others quietly produce a consistent edge.

Why This Matters

The purpose of this testing phase is not to find a perfect system. It is to demonstrate a disciplined way of studying market behavior. Every pattern in this article can now be:

This forms a foundation for systematic research rather than subjective belief. Moreover, that is ultimately the real lesson of Patterns to Profit.

In this article, we did more than translate ideas from a book into code. We built a small research system that allows patterns to be tested, compared, and measured in a disciplined way. Step by step, we transformed Larry Williams’s short-term observations into a working Expert Advisor that can be executed, repeated, and verified on historical data.

The results show an important lesson. Some patterns offer a clear edge, some perform only in specific conditions, and some fail when exposed to real market behavior. This confirms one of the book’s main themes. Markets are not random in the short term, but not every pattern deserves our capital. Only those that survive objective testing are worth attention.

The real value of this work is not in the numbers alone. It lies in the framework that was built. We now have a flexible engine that can host many ideas, apply consistent risk rules, filter trades by time, and evaluate performance without emotion. This approach allows trading research to move from belief to evidence.

From here, the path is open. New patterns can be added. Existing rules can be refined. Different markets, timeframes, and risk models can be tested. Each change becomes a controlled experiment rather than a guess.

In the end, profitable trading is not about finding a single perfect pattern. It is about building a process that discovers what truly works, protects capital when it does not, and keeps improving through disciplined research.

Read more on mql5.com

This news is powered by mql5.com mql5.com

Share this:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook

Like this:

Like Loading...

Related

Gold trading strategy | October 13-14 for OANDA:XAUUSD by GoldTradingProX
LongPoint Asset Management Inc.: LongPoint Announces Management Fee Rebate on Two of Canada’s First Triple Levered ETFs
LongPoint Changes Tickers and Reduces Fees on Commodity ETFs
Helix Alpha Systems Ltd Engineers Quantitative Research for Markets That Cannot Be Forecast
$NCDL | Where are the Opportunities in ($NCDL) (NCDL)

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Email Copy Link Print
Previous Article Nivex CEO Simon Hardy Unveils NXB Mechanism and Quant-Mind Global Partner Program to Build a Long-Term Ecosystem
Next Article Relief Rally Leads To Green Bitcoin, Altcoin Charts, But Will It Last?
© Market Alert News. All Rights Reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Prove your humanity


Lost your password?

%d