Keep the day's books and the biggest day. Then stop each day at the rule's share of your profit target.

With no day above 30% of the profit and a $3,000 target the cap is $900. A day that stops there can never be more than 30% of a profit that reached the target. The script below does it.

We checked it on back-to-back example evaluations over two years of MNQ. Without the cap 49 of 146 evaluations reached the target and 1 met the rule. With the cap 37 of 98 reached it and 33 met the rule. The other 4 each had a day above $900: the trade went past the cap on its first candle before the limit had the fill's price.

The code in three parts

1. The books

Add up strategy.closedtrades.profit after costs for the day's profit, the profit so far and the biggest day. The day starts at the futures day's first bar: the 18:00 New York reopen. The books count from csFrom: set it to your evaluation's start.

2. The check

The biggest day's share of the profit so far is csTop / csTotal. The rule is met while it is at or under the share.

3. The cap

Each day stops at the share of the target. Its price goes in the trade's limit from the candle after the fill and the day takes no new entry once it is reached. Put not csHit in front of each entry's condition.

The rule on its own · 38 lines

// ── The consistency rule ───────────────────────────────────────────────────────────────────────── // Example numbers, not any firm's: take yours from your plan's own page csTarget = input.float(3000, "Profit target ($)", minval=1, group="Consistency rule") csShare = input.float(30, "Most of the profit one day may make (%)", minval=1, maxval=100, group="Consistency rule") csCapOn = input.bool(true, "Stop each day at that share of the target", group="Consistency rule") csFee = input.float(2.5, "Commission per contract each side ($)", minval=0, group="Consistency rule") csFrom = input.time(timestamp("2000-01-01"), "Count from your evaluation's start", group="Consistency rule") // The books, from the closed trades after their costs: the day's profit, the profit so far and the // biggest day so far. They count only the trades that close from csFrom on: set it to your // evaluation's start. A futures day starts at its first bar, the 18:00 New York reopen var float csDay = 0.0 var float csTotal = 0.0 var float csTop = 0.0 var int csSeen = 0 var bool csHit = false while csSeen < strategy.closedtrades if strategy.closedtrades.exit_time(csSeen) >= csFrom csDay += strategy.closedtrades.profit(csSeen) csTotal += strategy.closedtrades.profit(csSeen) csSeen += 1 csTop := math.max(csTop, csDay) if session.isfirstbar csDay := 0.0 csHit := false // The check: the biggest day's share of the profit so far csTopShare = csTotal > 0 ? csTop / csTotal * 100 : na // The cap: a day that stops at the share of the target can never be more than that share of a // profit that reached the target. Its price goes in the trade's limit, as for a daily profit target csCap = csShare / 100 * csTarget csPriceLong(entry, size) => entry + (csCap - csDay + 2 * csFee * size) / (size * syminfo.pointvalue) csPriceShort(entry, size) => entry - (csCap - csDay + 2 * csFee * size) / (size * syminfo.pointvalue) if csCapOn and not csHit and csDay >= csCap - 0.005 csHit := true 

Paste it under your strategy() line. Put not csHit in front of each entry's condition and csPriceLong or csPriceShort in each exit's limit from the candle after the fill. The full script below does both.

The rules check

Each example evaluation starts at $0 on a futures day and ends when its closed profit reaches $3,000 or falls to its floor. The floor sits $2,000 under the highest closing balance of its days and stops rising at the start. The next one starts on the next day. On reaching the target the rule is met when no day made more than 30% of the profit. These are example numbers and no firm's.

RUN EVALUATIONS REACHED THE TARGET MET THE RULE A DAY ABOVE 30% FAILED MEDIAN DAYS TO THE TARGET
No cap 146 49 1 48 96 4
$900 cap in the trade's limit 98 37 33 4 60 7

One evaluation of each run was still open when the bars ended. Trades count when they close.

Without the cap the biggest day made 61.1% of the profit at the median when the target was reached. 7 evaluations reached it in a single day. With the cap the median was 25% and none reached it in one day.

The two runs

RUN TRADES WON DAYS CAPPED 2 YEARS 4 NOV 2024 → 23 FEB 2026 24 FEB 2026 → 22 OCT 2026 WORST DRAWDOWN
No cap 634 45.7% 0 +$38,615 +$52,995 −$14,380 −$39,845
$900 cap in the trade's limit 621 56.4% 278 +$40,110 +$38,270 +$1,840 −$17,312.50

5 MNQ contracts on a $50,000 account pay $2.50 a contract each side and a tick of slippage. The runs and the check were fixed before they ran. The worst drawdown is the deepest fall from a high between 4 November 2024 and 22 October 2026.

The cap did not cost this breakout. It made $40,110 over two years against $38,615 without it and its worst drawdown was $17,312.50 against $39,845. It made money in both periods: $38,270 to 23 February 2026 and $1,840 from 24 February 2026. Without the cap the strategy lost $14,380 from 24 February 2026.

The script as it ran

MNQ opening range breakout with a 30% consistency cap

A 15-minute opening range from 9:30 New York. A close through it after a close inside it enters from 9:45 to 12:00. The day takes up to 3 trades. The stop sits at the range's other side and the target at 2R. Each day stops at 30% of a $3,000 profit target: the cap's price is in each trade's limit from the candle after its fill. 5 MNQ contracts. The Data Window shows the biggest day and its share of the profit.

  • Trades: 621
  • Won: 56.4%
  • Profit factor: 1.14
  • Net: +80.2%
  • Worst drawdown: −21.7%
  • Worst trade: −$2,912.50

MNQ1! · 5-minute · 4 Nov 2024 → 22 Oct 2026 · $2.50 a contract each side and a tick of slippage · 5 contracts on a $50,000 account

+$38,270 from 4 November 2024 to 23 February 2026, +$1,840 from 24 February 2026 to 22 October 2026.

Pine Script v6 · 103 lines

//@version=6 // Suggested timeframe: 5-minute strategy("MNQ opening range breakout with a consistency cap", overlay=true, initial_capital=50000, default_qty_type=strategy.fixed, default_qty_value=5, commission_type=strategy.commission.cash_per_contract, commission_value=2.5, slippage=1, margin_long=0, margin_short=0) // ── The consistency rule ───────────────────────────────────────────────────────────────────────── // Example numbers, not any firm's: take yours from your plan's own page csTarget = input.float(3000, "Profit target ($)", minval=1, group="Consistency rule") csShare = input.float(30, "Most of the profit one day may make (%)", minval=1, maxval=100, group="Consistency rule") csCapOn = input.bool(true, "Stop each day at that share of the target", group="Consistency rule") csFee = input.float(2.5, "Commission per contract each side ($)", minval=0, group="Consistency rule") csFrom = input.time(timestamp("2000-01-01"), "Count from your evaluation's start", group="Consistency rule") // The books, from the closed trades after their costs: the day's profit, the profit so far and the // biggest day so far. They count only the trades that close from csFrom on: set it to your // evaluation's start. A futures day starts at its first bar, the 18:00 New York reopen var float csDay = 0.0 var float csTotal = 0.0 var float csTop = 0.0 var int csSeen = 0 var bool csHit = false while csSeen < strategy.closedtrades if strategy.closedtrades.exit_time(csSeen) >= csFrom csDay += strategy.closedtrades.profit(csSeen) csTotal += strategy.closedtrades.profit(csSeen) csSeen += 1 csTop := math.max(csTop, csDay) if session.isfirstbar csDay := 0.0 csHit := false // The check: the biggest day's share of the profit so far csTopShare = csTotal > 0 ? csTop / csTotal * 100 : na // The cap: a day that stops at the share of the target can never be more than that share of a // profit that reached the target. Its price goes in the trade's limit, as for a daily profit target csCap = csShare / 100 * csTarget csPriceLong(entry, size) => entry + (csCap - csDay + 2 * csFee * size) / (size * syminfo.pointvalue) csPriceShort(entry, size) => entry - (csCap - csDay + 2 * csFee * size) / (size * syminfo.pointvalue) if csCapOn and not csHit and csDay >= csCap - 0.005 csHit := true // ── The example strategy: a 15-minute opening range breakout, up to three trades a day ────────── // Your own entries go here, behind "not csHit", with the cap's price in the exit orSess = input.session("0930-0945", "Opening range (New York)", group="Strategy") tradeSess = input.session("0945-1200", "Entry window (New York)", group="Strategy") rMult = input.float(2.0, "Target (R)", minval=0.5, step=0.5, group="Strategy") maxDay = input.int(3, "Trades per day", minval=1, group="Strategy") qty = input.int(5, "Contracts", minval=1, group="Strategy") inOR = not na(time(timeframe.period, orSess, "America/New_York")) inTrade = not na(time(timeframe.period, tradeSess, "America/New_York")) var float orHigh = na var float orLow = na var int tradesToday = 0 var float stopLevel = na var float targetLevel = na if session.isfirstbar orHigh := na orLow := na tradesToday := 0 if inOR orHigh := na(orHigh) ? high : math.max(orHigh, high) orLow := na(orLow) ? low : math.min(orLow, low) // The setup: a close through the range after a close inside it. The stop sits at the range's // other side and the target at rMult times the risk. A new trade waits until the last one closed rangeSet = not inOR and not na(orHigh) longSetup = rangeSet and close > orHigh and close[1] <= orHigh shortSetup = rangeSet and close < orLow and close[1] >= orLow canTrade = inTrade and strategy.position_size == 0 and tradesToday < maxDay and not csHit and not session.islastbar if canTrade and longSetup and orLow < close stopLevel := orLow targetLevel := close + (close - orLow) * rMult strategy.entry("Long", strategy.long, qty=qty) strategy.exit("Long exit", from_entry="Long", stop=stopLevel, limit=targetLevel) tradesToday += 1 if canTrade and shortSetup and orHigh > close stopLevel := orHigh targetLevel := close - (orHigh - close) * rMult strategy.entry("Short", strategy.short, qty=qty) strategy.exit("Short exit", from_entry="Short", stop=stopLevel, limit=targetLevel) tradesToday += 1 // From the candle after the fill: the same stop, and the nearer of the target and the cap's price, // worked out from the fill's own price. The entry is a market order, so its price is known only at the // fill candle's close: a trade that goes past the cap on that first candle closes at the next open if strategy.position_size > 0 strategy.exit("Long exit", from_entry="Long", stop=stopLevel, limit=csCapOn ? math.min(targetLevel, csPriceLong(strategy.position_avg_price, strategy.position_size)) : targetLevel) if strategy.position_size < 0 strategy.exit("Short exit", from_entry="Short", stop=stopLevel, limit=csCapOn ? math.max(targetLevel, csPriceShort(strategy.position_avg_price, -strategy.position_size)) : targetLevel) if session.islastbar strategy.close_all("Session end", immediately=true) // The check, in the Data Window plot(csTop, "Biggest day ($)", display=display.data_window) plot(csTopShare, "Biggest day's share of the profit (%)", display=display.data_window) plot(rangeSet ? orHigh : na, "Range high", color=color.new(#16A56A, 0), style=plot.style_linebr) plot(rangeSet ? orLow : na, "Range low", color=color.new(#E5484D, 0), style=plot.style_linebr) 

The cap works like a daily profit target: see our daily profit target page. A firm's other rules kept in a script are on our prop firm page.

Questions

How do I code a consistency rule in Pine Script?

Keep the books from strategy.closedtrades.profit after costs: the day's profit, the profit so far and the biggest day. The rule is met while the biggest day is at or under its share of the profit. To keep it, stop each day at that share of your profit target: with no day above 30% of the profit and a $3,000 target that is $900. Put the cap's price in the trade's limit and take no new entry once the day reaches it. The script on this page does both in a block that goes on top of your own strategy.

How do I check my biggest day's share of the profit?

Add each closed trade's profit to the day and to the total. Keep the biggest day. The share is the biggest day over the total. The script plots both in the Data Window so you can read them on any bar.

Does it count from my evaluation's first day?

Yes, once its Count from input holds your evaluation's start: the 18:00 New York reopen before its first day. The books then count only the trades that close from that time on. Its default sits before any data: left alone it counts the chart's whole history.

Why cap the day at a share of the target?

Because a day capped at 30% of a $3,000 target can never be more than 30% of a profit that reached $3,000. In our rules check 33 of the 37 capped evaluations that reached the target met the rule. Without the cap 1 of 49 did.

Does the cap always keep the rule?

Not when the trade goes past the cap on its first candle. The limit takes the fill's price only at that candle's close and then fills at the next open past the cap. That happened on 4 capped days in our test. The 4 capped evaluations that broke the rule each had a day above $900.

Does a consistency cap cost profit?

It did not on this breakout. Over two years it made $40,110 with the cap and $38,615 without it. Its worst drawdown was $17,312.50 against $39,845. A capped evaluation took longer to reach the target: 7 days at the median against 4.

Can I run it myself?

Yes. Run opens the script on MNQ 5-minute bars in the Alpha Charts terminal. On a computer, a free account with no card runs it as published on all two years. Its inputs set the target, the share, the cap and where the count starts. A changed input or line makes it your own script: a free account then tests the newest 30 days of a chart under an hour. Prop Ready ($39 paid once) opens all two years for 30 days.

Is a backtest a prediction?

No. It is what a strategy's rules would have done on past prices with costs charged. Live fills, news and your own execution differ. Read it as a test of the rules and not as a forecast.

Every number comes from Alpha Charts' tester on MNQ 5-minute bars from 4 November 2024 to 22 October 2026. The runs were made on 27 November 2026. Alpha Charts is software for testing trading scripts and gives no investment advice. It is not a prop firm and is not connected with any. A backtest shows what rules would have done on past data. It does not show what they will do. Our methodology is in Data and methodology. Updated 27 November 2026.

Originally published at getalphacharts.com.