From our research notebook

From Indicator Rules to a Reliable Expert Advisor

We describe how we worked from visible indicator signals toward an EA with explicit timing, repeat-entry rules, risk checks and explainable decisions.

When we worked on indicator-based EAs, reading the indicator was only part of the job. A person could glance at a line or arrow and fill in the context. We had to decide which parts of that judgment belonged in the written rules.

We translated appearance into a sequence of events

We identified the source value and what would make it a valid signal. Then we asked what should happen if the colour stayed the same for twenty candles. A persistent condition and a new entry event need different treatment. Keeping track of waiting, armed, triggered and reset states gave us a way to express that difference.

We separated a setup from permission to trade

An entry could satisfy the indicator rules while spread, existing positions or account limits blocked an order. We kept those decisions distinct so a trader could understand why a visible setup did not become a position. We applied the same care to confirmation timing: conditions arriving together are different from a setup waiting for a later trigger.

We worked through the awkward moments

A restart, missing history or an empty buffer can reveal more about an integration than another ordinary entry. We use those situations to examine duplicate signals, data readiness and broker responses. The technical notes retain the detailed checklist, including how exits and opposite signals interact with protective rules.

Explore the technical detailOpen the full method, worked examples and implementation questions. We have kept this material here so you can follow the reasoning as far as you need.

An indicator can make a trading idea easier to see. It does not automatically make the idea ready for automation. A person can look at a colour, arrow, line, or zone and quietly use context that was never written down. An Expert Advisor cannot fill those gaps safely.

Across ten indicator-integration records in our anonymized archive, the recurring difficulty was not simply calling an indicator. The real work was defining what the output means, when it becomes valid, how long it remains active, what cancels it, and which risk and execution rules have authority after the signal appears.

Engineering note · ENG-01

How an indicator becomes a decision

Read from top to bottom: identify the indicator output, define its meaning, fix the decision time, apply trade permission, and record what happened.

  1. 01
    SourceName the indicator version, inputs, timeframe, buffer, object, or state being read.
  2. 02
    MeaningDefine the previous state, new state, direction, threshold, and tolerance.
  3. 03
    TimingChoose current or closed bar, update event, and once-per-bar behaviour.
  4. 04
    AuthoritySet what opens, blocks, modifies, or closes a trade—and which rule wins.
  5. 05
    EvidenceLog the decision and test restarts, missing data, repainting, and duplicate events.

Start with the output

Before discussing entries, the developer needs to know what the indicator actually exposes. A visible arrow may come from a numeric buffer, a chart object, a colour index, or a calculation that changes while the candle is open. Two indicators that look similar can require completely different integration methods.

The specification should record the indicator version and inputs, the exact value to read, the valid empty state, and the bar index. If only a compiled indicator is available, the integration also needs a short feasibility check. The EA should never assume that a visual element is stable or accessible simply because it appears on the chart.

Turn appearance into states

“The line turns blue” is useful human language. Code still needs a state transition. Was the previous value red? Did the blue state appear for the first time? Is a missing value different from neutral? Can the signal remain blue for twenty candles, and if so should the EA act once or once per candle?

A simple state model usually includes inactive, armed, triggered, blocked, and reset. The names can change, but the separation matters. It prevents a persistent indicator condition from opening repeated positions by accident and makes the behaviour easier to test against screenshots and logs.

Choose the decision moment

An indicator value on the current candle may change several times before close. Acting intrabar can be correct for a fast strategy, but that choice must be deliberate. Waiting for a closed candle is slower and often easier to reproduce. Neither policy is universally better; mixing them without saying so is the real problem.

The same decision applies to exits. A signal can disappear intrabar and return before close. The system must state whether disappearance is enough, whether a confirmed opposite state is required, and whether an emergency risk rule may close the trade earlier.

Separate signal from trade permission

A valid signal does not always mean a valid order. Existing exposure, spread, session limits, maximum trades, symbol settings, data readiness, or a portfolio-level stop may block the action. Keeping the signal state separate from trade permission makes the reason visible: the setup existed, but execution was not allowed.

This separation is especially important when several indicators confirm one another. The logic should define whether all conditions must be true at the same snapshot, whether one signal may remain armed while another arrives later, and how old a confirmation may become before it expires.

Test the awkward cases

Normal entries are only the first test. A dependable implementation also needs checks for terminal restart, timeframe change, missing history, a late-loading custom indicator, an empty buffer, duplicate ticks, broker suffixes, and an order that is requested but not filled.

Logs should show the indicator state, bar time, confirmation state, risk permission, and order result. That evidence does not make a strategy profitable. It does make disagreement diagnosable and protects the original idea from silent technical drift.

  • Identify the exact indicator version, inputs, buffer or object, and timeframe.
  • Define current-bar or closed-bar behaviour and the precise update event.
  • State whether a persistent condition triggers once, once per bar, or repeatedly.
  • Define confirmation age, reset conditions, conflict handling, and trade permission.
  • Record enough decision data to reproduce a missed, blocked, or duplicated trade.

Questions you may have

Can every custom indicator be used by an EA?

Not automatically. The output must be accessible and stable enough for the intended decision rule. A compiled-only or object-based indicator may need a feasibility check.

Should an EA always wait for a closed candle?

No. Intrabar logic can be valid, but it must be specified and tested as intrabar logic rather than judged later from a closed chart.

Does adding more confirmation indicators improve reliability?

Only when each condition has a clear role and timing policy. More filters can also reduce opportunity, create contradictions, or hide ambiguity.

A complete signal-to-trade contract

Scroll the diagram horizontally or open it at full size.

A complete signal-to-trade contract
Educational design example — values and states are not live performance.Open full diagram ↗

A complete signal-to-trade contract

Consider a synthetic oscillator with buffer 0. A BUY candidate appears on a completed M15 bar when the value crosses from ≤0 to >0. The source includes indicator name and version, symbol, M15 timeframe, settings hash and buffer number. The event expires at the next M15 close and is consumed only by a confirmed order or explicit expiry.

State transitions and expected outcomes
Situation State transition Order action Persisted evidence
Normal cross Absent → candidate → confirmed Ask risk permission once Source-bar time and event ID
EMPTY value Any → unavailable No request Missing-data reason
Repeated tick Confirmed → confirmed No duplicate Same event ID
Opposite signal Confirmed BUY → reset or conflict per contract No silent reversal Both sources and chosen priority
Risk veto Confirmed → blocked until expiry No retry each tick Veto reason and expiry
Restart Restore persisted state Reconcile account before action Last event and request ID
Broker rejection Sent → rejected Consume or retry only as pre-agreed Retcode and final policy

Feasibility inspection should produce a simple artefact: the named buffer or object can be read, values match the visual signal at recorded times, EMPTY and initialization behaviour are known, and repainting has been observed. If a compiled indicator exposes no stable machine-readable output, the project is conditional rather than automatically feasible.

The archive article selection used ten records, while the older Research hub showed eleven under a broader indicator-integration theme. Without the two membership lists they cannot be reconciled. The public row data contains six exact indicator-integration feature labels. These are three scopes, not evidence that one number is wrong.

What to verify

  • Give the trader and developer the same frozen seven scenarios and compare decisions before coding orders.
  • Test expiry and consumption separately; a blocked signal must not regain authority on the next tick.
  • On restart, inspect actual orders and positions before deciding whether an earlier request completed.

Limits of this example

The contract proves repeatable interpretation and implementation. It does not prove the trading rule has positive expected value.

Editorial ownership and primary references

Reviewed by POLARIS Research

Evidence scope

This article combines official platform behaviour with recurring, anonymized implementation patterns. Exact trading rules and client material are excluded.

Primary references

These references support platform behaviour or research concepts. They do not validate POLARIS performance and do not guarantee future results.

Explore the next relevant layer

Move between focused research, system engineering and portfolio construction without losing the context of this page.

Contact POLARIS on WhatsApp