Skip to content

AI coding

Your AI-Built Trading Bridge Placed One Trade. Here Are the Nine Tests to Run Next

Your AI-built bridge just did what you asked. A TradingView alert fired, your code received the webhook, and a position opened on your MetaTrader 5 demo account. That single trade proves one thing: the happy path works once, under conditions you controlled. It does not tell you what happens when TradingView sends the same alert twice, when your process restarts mid-order, or when the broker rejects a request and your code assumes it went through.

This article sets out nine tests to run before that bridge touches a live account. Each follows the same shape: the condition that can occur, the consequence if the code is not ready for it, a safe way to test it on a demo account, and who is responsible for the outcome. These are proposed tests for you to run. We have not run them against any particular tool, and passing them is not something any connector, PineConnector included, should be assumed to do without evidence.

Who this is for: anyone who has used ChatGPT, Claude or another assistant to build a webhook-to-MT5 connector and wants to know what "working" should mean before real money is involved. If you have no interest in operating your own bridge, the same nine questions are what you should ask of any connector vendor before you sign up.

Nine illustrative acceptance-test categories across alert delivery, the receiving terminal, broker outcomes and oversight.
Test the failure paths as well as one successful request; reconcile an uncertain broker result before repeating it.

Why one successful trade is weak evidence

A trading bridge sits between two systems that make no promises to each other. TradingView delivers alerts on a best-effort basis and says plainly that webhooks "may occasionally fail to reach the specified URL"[1]. MetaTrader, at the other end, returns a result structure for every order request, and its own documentation has the calling code check the return code rather than assume success[2]. Everything interesting happens in the gap between those two facts. A single test trade exercises none of it.

Anthropic's guidance for working with AI-generated code makes the same point from the other side: give the model "a check it can run", because without one "looks done" is the only signal available[3]. The nine tests below are that check, translated into trading infrastructure.

Test 1: The same alert arrives more than once

Condition. TradingView's resubmission policy states that if your endpoint "returns an HTTP response status code between 500 and 599 (except for status code 504)", the notification "will be sent again after 5 seconds", and that "the maximum number of webhook sends for one trigger can be 4"[4].

Consequence. If your code opened a position and then crashed while writing the log, returning a 500, the same instruction can arrive up to three more times. Whether that produces up to four positions depends entirely on how your receiver identifies a repeated message. That consequence is an engineering inference from TradingView's documented behaviour, not something TradingView states.

Test. On a demo account, send one alert and have your endpoint deliberately return a 500 after processing it. Wait thirty seconds. Count the positions on the terminal, not the log lines in your bridge.

Do not assume that every retry produces a duplicate, or that any connector prevents it. Look at the orders.

Test 2: Your code takes too long to answer

Condition. TradingView cancels the request if "a remote server takes longer than three seconds to process a request"[1].

Consequence. A bridge that waits for the broker's fill before replying will be cancelled on a slow day. What your code does after the cancellation, and whether it treats the cancelled request as never received, is the question.

Test. Add an artificial four-second delay before your response and fire an alert. Check whether the order was still placed, whether TradingView marked the alert as failed, and whether a retry followed.

Do not assume that a fast reply and a placed order are the same event. They are two separate stages, and the reply should acknowledge receipt only.

Test 3: The process restarts with work pending

Condition. A dependency update, a crash, a host reboot. Your bridge stops between receiving an instruction and confirming the broker's result.

Consequence. Anything held only in memory is gone. The alert may have been acknowledged to TradingView and never acted on, or acted on and never recorded.

Test. Fire an alert and kill the process the instant it logs receipt. Restart it. Inspect what it does with the half-finished work: replays it, drops it, or does not know it existed. Then compare against the terminal.

Do not assume that "it restarts automatically" means it recovers correctly. Restarting is a process-supervisor feature. Reconciliation is code you have to write.

Test 4: A valid instruction points at the wrong place

Condition. Two MT5 accounts on one machine. A symbol that is XAUUSD at one broker and GOLD at another. A volume field that one broker reads in lots and your script filled in units.

Consequence. The order succeeds. It is simply not the order you meant, on the account you meant.

Test. Write down the demo account, server, exact symbol, direction, volume and required stop/target levels before sending. Compare the received message, request, broker response and resulting position against that list. PineConnector’s format is LicenseID,Command,Symbol,Parameters; field order and units matter. [5]

Do not assume that a filled order is the intended order.

Test 5: The broker says no

Condition. A broker may reject an order or leave it awaiting execution. Order states, deals and resulting positions are different records, so a receiver must track the state appropriate to the requested action. [6]

Consequence. Sending a request is not evidence of a fill. Record the broker response and distinguish an accepted or pending order from an executed deal and resulting position. The appropriate response depends on the requested action; a single “DONE only” test is not a complete outcome model. [6]

Test. On the demo account, request a volume the account cannot afford, then a volume below the symbol's minimum, then an order while the market is closed. Confirm your bridge records the specific return code each time and does not mark the trade as open.

Do not assume a pre-flight check guarantees the fill. It only rules out some failures in advance.

Test 6: The broker accepted, but you never heard back

Condition. The order request reaches the terminal and the broker fills it, but the connection between your code and the terminal drops before the result comes back.

Consequence. Your code sees a timeout. The naive fix, retrying, now places a second order that the broker also fills.

Test. Simulate an uncertain response by interrupting the connection to the terminal immediately after sending. Before allowing any retry, have the code query open positions and pending orders and reconcile against what it intended. Only then decide.

Do not assume that blind resubmission is safe. A lost response is not a rejected order.

Test 7: Secrets in the message, the source, or the log

Condition. TradingView's own guidance is to "ensure that you don't include sensitive information such as login credentials or passwords in the webhook body"[1]. AI-generated scaffolding often reads credentials from wherever is quickest, and logs whatever it received.

Consequence. A broker password in a webhook body travels through TradingView's servers and lands in your access log. A credential in a source file ends up in version control.

Test. Use dummy values to check alert bodies, source control and ordinary logs for unintended exposure. Required runtime credentials belong in protected configuration or secret storage. Record which component needs each secret and who can read it.

Do not assume that AI-generated or open-source projects necessarily expose secrets. Many do not. Check yours.

Test 8: You changed the script, but the alert did not

Condition. TradingView's Pine Script documentation explains that creating an alert "saves a 'snapshot' of the script, its inputs, and the current chart's context on TradingView's servers", and that subsequent "changes to the script, its inputs, or the user's chart do not affect that created alert"[8]. The documented remedy is to "delete the existing alert and create a new one".

Consequence. This one is upstream of your bridge and no hosting arrangement can fix it. The bridge faithfully executes an instruction generated by last week's logic.

Test. Change a visible input in the script, such as the lot size in the alert message. Trigger the old alert. Confirm that the old value arrives. Then recreate the alert and confirm the new one does.

Do not assume that a saved chart means a current alert.

Test 9: It breaks at 3am and you are asleep

Condition. Every one of the previous eight scenarios, happening when nobody is watching.

Consequence. The difference between a five-minute incident and a five-hour one is detection and a written recovery procedure.

Test. Answer three questions in writing. How would you learn the bridge has stopped, other than by noticing missing trades? Who restarts it, and how? What is the first command you run to reconcile the terminal against what should have happened?

Do not assume that paying a provider makes this disappear. A managed service moves the hosting and restart responsibility to the provider. It does not review your alert logic, and it does not know what trade you intended.

The verification checklist

This is the pass or fail list for every test above. It applies to a bridge you built, a free connector you downloaded, and a paid product such as PineConnector alike. Where a vendor's documentation does not answer an item, ask their support before assuming the answer.

Check Evidence that counts Evidence that does not count
The expected trade exists An open position or order on the terminal matching your written expectation A log line saying "order sent"
On the intended account Account number and server name on the position match your list The bridge was "configured for" that account
Correct symbol, direction, volume, stops Each field compared individually against the expectation "It opened a trade"
No unintended duplicates Position count after Tests 1, 2 and 6 equals the number you intended The alert fired once in TradingView
Result code recorded The MT5 return code and comment stored per instruction, including rejections An HTTP 200 returned to TradingView
Recovery after restart Documented behaviour for in-flight work, verified in Test 3 The process is running again
No unnecessary secret exposure Dummy secrets absent from alert bodies, source control and ordinary logs; required runtime secrets kept in protected storage "We use environment variables"
Alert reflects current script Recreated after the last script change The chart looks right
Someone is responsible at 3am Written detection method and recovery steps Auto-restart is enabled

Where PineConnector Edge fits, and where it does not

Two of the nine tests are about keeping a terminal alive: Test 3 and Test 9 both get harder when the MT5 terminal itself is the thing that restarts or goes offline. That is the part PineConnector Edge, PineConnector's managed MT5 hosting, takes on. PineConnector runs the MetaTrader 5 terminal on its own infrastructure. What that means for your evidence today, according to the Edge Guide[9]:

  • Hosted logs: Portal → Edge exposes Experts and Journal. Use Experts for EA processing and Journal for terminal trading messages, order requests and broker responses.
  • Processing evidence: Portal → Bridge / Logs shows Signal IDs, processing results and an Edge tag for hosted processing. Match that evidence with the broker account.
  • Instance controls: the Edge instance controls, documented under Connection management, let you restart or terminate the instance. Check open positions, pending orders and running alerts before using them.
  • EA Settings: view and change the hosted EA's settings in Portal → Edge → EA Settings. Applying a change restarts the terminal, so signals pause for about a minute; confirm the tab says your saved settings are running before relying on a change. A local EA change does not alter the hosted instance.
  • Symbols: Portal → Edge → Symbols lists every symbol your broker offers, with its specification, so you can copy the exact symbol name into your alert. Symbol names are case-sensitive and can differ between account types on the same server.

Edge hosts MT5 with the PineConnector EA and does not host third-party EAs. A custom bridge cannot be deployed there as if Edge were a general-purpose server. Hosting does not answer duplicate delivery, recovery or intended-trade questions for you; verify the documented behaviour and request clarification where it is not established. [9]

Consult current PineConnector plans and Edge scope. Current Core, Plus and Pro include Edge; legacy access can differ. Feature availability must be checked independently from whether a demo order succeeds.

Frequently asked questions

Do I really need all nine tests for a small personal bot?

Tests 1, 4, 5 and 8 cover the failures that produce wrong or duplicate orders on an otherwise healthy day. Start there. The rest cover what happens on a bad day, and a live account will eventually have one.

Can I run these against a paid connector instead of my own code?

Some checks, such as confirming routing, symbol, volume and alert version, can be observed on an isolated demo account. Tests that deliberately change the endpoint’s HTTP response, delay its reply or interrupt its process require control of that component or a vendor-approved procedure. A hosted terminal or Bridge test-signal control alone does not provide that access.

Does PineConnector pass these tests?

This article does not claim that. PineConnector publishes its command syntax and an Edge Guide, both cited above, and those pages do not describe duplicate handling or restart reconciliation. Ask support the specific question and keep the answer with your test notes.

Is an AI assistant a bad way to build a bridge?

No. It is a fast way to produce a first version. The tests exist because a first version, however produced, has only been shown to work once.

Next step: check the current Edge scope if you want hosted MT5. For a custom bridge, document which component each proposed test requires you to control, and run only on an isolated demo setup. These are proposed checks, not tests performed in this article.

Reviewed 9 September 2026. Facts and prices were checked against the linked sources on that date.

Sources

  1. TradingView Help Center – How to configure webhook alerts, accessed 9 September 2026.
  2. MetaQuotes – MetaTrader 5 Python integration: order_send, accessed 9 September 2026.
  3. Anthropic – Claude Code best practices: Give Claude a way to verify its work, accessed 9 September 2026.
  4. TradingView Help Center – Webhook resubmission, accessed 9 September 2026.
  5. PineConnector Docs – Syntax, accessed 23 September 2026.
  6. MetaQuotes – Basic Principles of Trading, accessed 23 September 2026.
  7. MetaQuotes – MetaTrader 5 Python integration: order_check, accessed 9 September 2026.
  8. TradingView – Pine Script documentation: Alerts FAQ, accessed 9 September 2026.
  9. PineConnector Docs – Connect your MT5 account, accessed 23 September 2026.
  10. PineConnector – PineConnector Edge: managed MT5 hosting, accessed 9 September 2026.

PineConnector executes the instructions you send it. It does not select trades, manage money, or hold funds. Trading carries risk, and past performance of any strategy does not indicate future results.

Corrections reviewed 23 September 2026 against the cited primary documentation accessed on that date; Edge EA Settings and Symbols updated 6 October 2026. No trading account was tested and no Pine Script or MQL5 code was compiled for this update.

Back to PiCo Blog

Run your strategies on our managed infrastructure

Bridge routes TradingView alerts to MetaTrader. Edge hosts and runs MT5 for you.

Core Trial

Then $59/month unless you cancel.

$7for 7 days

  • 3 account connections
  • 1 hosted MT5
  • Unlimited alerts, routed by Bridge
Try Core for $7

Trusted by 66,000+ traders in 156 countries and territories · <1s typical latency

Your Edge MT5 runs in our cloud · nothing to install · built on Microsoft Azure