Separate breakout detection from entry

A breakout above a rolling high can be followed by a pullback. Instead of buying immediately, a MultiCharts PowerLanguage signal can freeze the breakout level and wait for a subsequent retest. This is a long-only educational strategy, not a claim that retests improve returns.

Rules and numerical example

Calculate the highest high of the preceding 20 bars, excluding the current bar. When a completed bar closes above that level, store it and arm the setup. During the next five bars, cancel if the close falls more than 0.5 price points below the stored level. Otherwise enter next bar at market if the low reaches within 0.5 points above the level and the close finishes above it. Do not move the stored level as new highs form.

A Frozen-Level Breakout Retest Strategy in PowerLanguage

Illustrative close sequence: the reference is 100, breakout close 101.5, retest close 100.4 with an assumed low of 100.2, then the next bar is eligible for entry. The chart shows closes, not actual fills or intrabar lows.

PowerLanguage signal

Inputs: Lookback(20), WaitBars(5), Tolerance(0.5), RiskPoints(2);
Variables: Level(0), Armed(false), Age(0), PriorHigh(0);
PriorHigh = Highest(High[1], Lookback);
If MarketPosition = 0 then begin
    If Armed then begin
        Age = Age + 1;
        If Age > WaitBars or Close < Level - Tolerance then
            Armed = false
        else if Low <= Level + Tolerance and Close > Level then begin
            Buy ("RetestLE") next bar at market;
            Armed = false;
        end;
    end
    else if Close > PriorHigh then begin
        Level = PriorHigh;
        Age = 0;
        Armed = true;
    end;
end
else Armed = false;
SetStopContract;
SetStopLoss(RiskPoints * BigPointValue);

Apply to a chart with sufficient history, one contract and pyramiding disabled. Use bar-close calculation without intrabar order generation for this example. Tolerance and RiskPoints are price units, not ticks; align inputs with MinMove/PriceScale. SetStopContract makes SetStopLoss a per-contract monetary stop; BigPointValue converts a price-point distance into contract currency value. For example, a two-point stop with a $50 point value implies $100 per contract before costs. The stop is relative to the actual entry, not the breakout level.

Testing and execution

Compare against immediate breakout entry using identical dates, sizing and costs. Include failed retests, gaps, session boundaries and a retest on the fifth bar. Test with detailed historical data and appropriate Bar Magnifier settings because intrabar stop sequencing can change results. The example has no profit target or session exit; add these only as separately tested rules. Live automation also requires order rejection handling and position synchronization. This sample has not been compiled or backtested. Stops can slip, and leveraged trading involves substantial loss risk.

For session filters or execution safeguards, see Custom MultiCharts strategy Development Services.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.