Strategy testing and trading software · Germanycontact@stratcorealpha.com · DE

Illustrative engineering sample

Pine Script MTF acceptance specification

A practical example of how a multi-timeframe indicator is made testable before coding: confirmation timing, look-ahead prevention, merge ownership, state transitions, alerts and chart evidence are frozen in writing.

This sample is about deterministic software behavior. It is not a trading signal, backtest result or profitability claim.

Open-source timing inspector

Download the companion Pine Script v6 diagnostic. It plots the last confirmed higher-timeframe close separately from the still-developing HTF close, exposes the state in a table and alerts when the prior HTF candle becomes fixed. It is an educational acceptance aid, not a trade signal.

Download Pine v6 source

Timing contract

EventEligible whenVisible behavior
Source pivotOnly after the full right-bar window closesNo historical level before confirmation
Lower-timeframe displayFirst eligible bar after source confirmationNo future value copied backward
Touch alertFirst tolerance entry after activationOnce per level event
Break alertConfirmed close beyond the invalidation ruleA wick alone does not break the level

State model

  1. 1

    Candidate

    A source pattern exists but still needs future bars to confirm.

  2. 2

    Confirmed

    The source event is knowable and may enter the active set.

  3. 3

    Active

    The level is visible and eligible for touch or break events.

  4. 4

    Touched

    Price entered tolerance; repeat alerts remain suppressed.

  5. 5

    Broken

    The approved invalidation event occurred and the level is retired.

Alert contract

  • Separate confirmed, touch, break and optional retest events.
  • Intrabar versus closed-bar timing is an explicit input decision.
  • Each event has a defined duplicate-suppression and re-arm rule.
  • Reload and symbol/timeframe changes reconstruct deterministic state.

Positive acceptance cases

  • A confirmed 4H resistance first appears on the eligible lower-timeframe bar and never moves afterward.
  • Daily and 4H resistance inside merge tolerance produce one deterministic level with the agreed owner label.
  • After a chart reload, the active set reconstructed from confirmed data matches the prior state.

Negative acceptance cases

  • An unconfirmed source pivot never appears on historical lower-timeframe bars.
  • With close-based invalidation, a wick through resistance does not mark it broken.
  • An event that already fired does not alert again until the approved re-arm rule occurs.

Phase-1 boundary

A Phase-1 specification delivers the frozen rule set, input list, event/state matrix, chart acceptance annotations, feasibility limits and a Phase-2 implementation quote. Unless explicitly quoted, it does not include a finished indicator, strategy optimization, guaranteed trading results, protected-code reconstruction or broker execution.

Have a chart idea?

Send one positive and one negative chart example for a bounded quote.

Email the brief

Trading risk disclosure

Futures and forex trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing one's financial security or lifestyle. Only risk capital should be used for trading, and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.

Hypothetical performance disclosure

Hypothetical performance results have many inherent limitations. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown. There are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical results are generally prepared with the benefit of hindsight, do not involve financial risk, and cannot completely account for the impact of financial risk in actual trading. Market conditions, the ability to withstand losses, and adherence to a trading program can all materially affect actual results.

NinjaTrader trademark disclosure

NinjaTrader® is a registered trademark of NinjaTrader Group, LLC. No NinjaTrader company has any affiliation with the owner, developer, or provider of the products or services described herein, or any interest, ownership or otherwise, in any such product or service, or endorses, recommends or approves any such product or service.

Testimonials, when shown, may not represent the experience of other clients and are not a guarantee of future performance or success. Virtual-currency trading carries additional risks. See the CFTC customer advisories. Read the full financial risk disclaimer.