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

TradingView signal timing

38 checks passed: should your Pine signal wait for the candle close?

Your live signal can disappear before the candle closes. Our signal rule passed 38 Python checks, including keeping an unfinished candle silent and leaving earlier signals unchanged when later prices changed. Those checks cover the written behavior. Before you connect an indicator to your EA, decide whether you want a changing live hint or a signal that waits for the close.

Our SignalProof indicator on an EURUSD daily TradingView chart with separately labelled hypothetical statistics
Native Pine sample, EURUSD daily. The separately labelled hypothetical candle-price statistics do not record broker fills. The 38 Python checks cover the written signal rules.

What you mean by a signal

A price can move above your entry level, come back below it and cross it again while the same candle is still open. If your rule reacts to each change, a label can appear and disappear. If your rule waits for the close, those early movements do not become signals. Both choices can be useful. Your alert and the program receiving it need to use the same choice.

Waiting has a cost you can see: the decision comes later. A confirmed signal cannot give you the earlier price simply because that price looked good during the candle. Before you ask for faster signals, write down which price change should trigger the action and what should happen if the price immediately moves back.

What our checks actually did

We ran a small Python copy of the written signal rules with controlled inputs. An unfinished signal candle changed nothing. The same input marked complete did produce its signal. An unfinished candle touching a target did not close the simulated position; a completed candle could. That makes the close rule explicit at both the entry and the exit.

We also changed later prices and compared the earlier decisions. Earlier signals stayed the same. Running the same inputs again gave the same state. These are useful checks when you want a stable historical reading, because an attractive old label tells you little if changing tomorrow's input can move it.

The screenshot is a separate native Pine run on an EURUSD daily TradingView chart. It shows our indicator, its labels and its table. The Python checks and the chart answer different parts of the question. The live reload behavior, another market and an intraday timeframe still need their own checks before you rely on them.

Keep the alert and the position together

Our rule ignored another raw signal while a simulated position was already open. After a buy, another buy stayed blocked; a later sell could become the next direction. The stop and target stayed fixed when the current volatility changed. Otherwise a chart could quietly change what the original entry meant.

These details matter at the receiving end too. If your EA gets a repeated message, does it open another trade, ignore it or update the existing position? A Pine label cannot answer that for the EA. Keep the intended action beside the message, and try the repeated-message path before using it on an account.

Read the small table with its limits

The screenshot labels its statistics hypothetical. They use candle prices and a stated ordering when a stop and target are both touched. They do not show broker fills or a live account result. A table can count the rule consistently while saying nothing about the price you could actually trade.

Keep that distinction when comparing two versions. A faster version might act before the close, while a slower version waits. If both reports silently use the closing price, you have not compared the behavior you intend to run. Keep timing, alerts and fill assumptions together.

Start with your current chart

Save the chart, timeframe, inputs and the exact moment you expect the signal. Compare the still-open candle with the same candle after its close. Then reload the chart and check whether that completed decision remains. Use the same message at the EA end, including a repeated delivery of it.

Our guide to Pine and MT5 feed differences covers another reason matching rules can show different entries. The saved-version guide keeps a test attached to the version you actually loaded. For your own EA, start with the free Bot Blueprint and record the signal timing you want.

Sources and related guides

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.