Skip to content
Docs
Open Portal
Copy manually

Your browser did not allow direct clipboard access. Select and copy the text below.

Check strategy behaviour before connecting

Compare a strategy with its adapted copy and check the differences between simulated orders, alert messages and broker positions.

Before enabling a strategy’s webhook, explain one complete entry-to-exit cycle. You will compare the original with its adapted copy, check their alert settings, and decide what evidence is still missing.

Have the source and settings from Adapt an existing strategy available. Keep the practice strategy’s Enable order-fill alerts off while inspecting it. If an older alert for this workflow exists, pause it in TradingView’s Alerts list; changing a chart setting does not stop its saved copy.

1

Match the chart and settings

For the original and adapted copies, use the same symbol, interval, standard candles, EMA length and available history. Hover over each strategy’s name on the chart, open its Settings gear, then select Properties.

Compare Default order size, Script execution and Order execution delay, as well as the capital and pyramiding values.

What you should see

A difference in the selected data or strategy properties will not masquerade as a change in the integration code.

Strategy Properties show order size 1 Quantity, Script execution On bar close and Order execution delay One tick.
Enlarge screenshot
These are simulator settings: 1 Quantity (1), On bar close (2), and One tick (3). They do not set MetaTrader volume or guarantee its fill timing.

These are simulator settings: 1 Quantity (1), On bar close (2), and One tick (3). They do not set MetaTrader volume or guarantee its fill timing.

Strategy Properties show order size 1 Quantity, Script execution On bar close and Order execution delay One tick.

The picture shows the original Pine practice: strategy. Inspect the same fields on your adapted copy. For the supplied practice files, keep these choices:

Choice Practice value What it affects
Default order size 1 with Quantity selected TradingView’s simulation. It is independent of the PineConnector lot input.
Initial simulated capital 1,000,000 Funds available to the simulation.
Pyramiding 0 The example does not add successive entries while already long.
Script execution On bar close The practice rules calculate at the chart bar’s close. Leave the additional execution options unselected.
Order execution delay One tick The simulated fill follows the order request under the timing taught in this module.

Inputs and Properties can override the starting values in a saved chart instance. Inspect the actual controls, not only the source declaration. Changing recalculation or fill settings changes the experiment. TradingView’s strategy-properties reference

2

Choose a closed trade

In the strategy report below the chart, click the table-shaped Trades control. Under List of trades, choose a closed long trade. Read its Entry and Exit rows, then identify their conditions and simulated fills on the chart.

What you should see

You can connect the entry and exit in the report to their conditions on the chart.

Switch the report between the original and adapted copies if both are loaded. Confirm that you are reading the intended script before comparing rows.

The strategy report shows its table-shaped Trades control and List of trades heading.
Enlarge screenshot
In the strategy report below the chart, select the table-shaped Trades control (1). The heading changes to List of trades.

In the strategy report below the chart, select the table-shaped Trades control (1). The heading changes to List of trades.

The strategy report shows its table-shaped Trades control and List of trades heading.
A closed simulated trade has separate entry and exit times, prices and a simulated size of 1.
Enlarge screenshot
Read the Entry and Exit rows together (1). Size 1 belongs to TradingView’s simulation (2); it does not set your MetaTrader lot size.

Read the Entry and Exit rows together (1). Size 1 belongs to TradingView’s simulation (2); it does not set your MetaTrader lot size.

A closed simulated trade has separate entry and exit times, prices and a simulated size of 1.

Record your observations in a small note:

Event What to record
Entry condition Which rule became true, and on which closed candle.
Simulated entry The strategy entry ID, fill time and simulated quantity.
Exit condition Why this example requested a full close.
Simulated close The closing fill and resulting flat simulated position.

For the supplied files, adding the message fields should leave the EMA calculation and order conditions unchanged. An unexpected difference is a reason to inspect the copied source and settings before moving on. Two matching examples do not prove every possible strategy case behaves identically.

Watch for a misleading comparison: your custom Entry triangle marks a condition. TradingView’s order marker represents the emulator’s fill. Compare the same kind of event on both copies; do not move the code’s condition merely to line up two different markers.

The Entry condition triangle is on one candle and TradingView simulated entry arrow is on the next candle.
Enlarge screenshot
The lower Entry triangle marks the condition. TradingView’s separate arrow on the following candle marks the simulated fill. This is a simulator result, not a broker trade.

The lower Entry triangle marks the condition. TradingView’s separate arrow on the following candle marks the simulated fill. This is a simulator result, not a broker trade.

The Entry condition triangle is on one candle and TradingView simulated entry arrow is on the next candle.

The complete connector example uses order fills, attaches alert_message to its entry and close calls, and expects {{strategy.order.alert_message}} in the alert’s Message field. It does not contain an additional alert() entry route.

Before creating that alert, check the intended result for both actions:

Event Expected PineConnector request
Simulated long entry fill buy for the intended broker symbol and explicit broker lot amount.
Simulated full closing fill closelong for that broker symbol, within the receiving EA’s position scope.

If Signal Authentication is required, both messages need the matching secret. A working entry message does not establish that the exit message is correctly configured. Signal Authentication

strategy.order.contracts and strategy.position_size describe the strategy’s simulated quantities. Do not insert them into a broker-lot field without an explicit, verified conversion. The supplied connector avoids that assumption by using a separate Lots per entry input. TradingView’s strategy-alert placeholders

The connected strategy has a separate Lots per entry value of 0.01 and explicit stop/target inputs.
Enlarge screenshot
Lots per entry controls the message sent to MetaTrader (1). Review protection and its units separately (2). The displayed values are examples, not a broker-size recommendation.

Lots per entry controls the message sent to MetaTrader (1). Review protection and its units separately (2). The displayed values are examples, not a broker-size recommendation.

The connected strategy has a separate Lots per entry value of 0.01 and explicit stop/target inputs.

Compare the two quantities: Size 1 in the earlier simulated-trade picture and Lots per entry 0.01 in this example’s message settings. They belong to different systems and are not interchangeable.

An adapted strategy has a buy in an alert() call and another buy attached to strategy.entry(...). Its TradingView alert listens to both calls and fills. What should you check before enabling the webhook?

Show the answer

Check whether both messages represent the same intended entry. If they do, select one deliberate event route and remove or disable the duplicate path. Also check for older active alerts. A once-per-bar setting on the alert() call does not combine it with a separate order-fill event.

The complete connector sends an optional broker stop and target with its buy message. Its simulated strategy still exits on the downward EMA cross. It does not place matching simulated stop-loss or take-profit orders.

A zero protection input omits that message field; the receiving EA’s settings may still supply a protective value. Inspect the actual accepted stop and target rather than inferring their absence from the script’s zero input.

That means the broker can close first while the strategy remains long. The preview’s simulated quantity will still describe TradingView’s state. A later closelong request can then reach a broker scope whose positions no longer match the simulation.

For partial exits, pending orders, multiple entry IDs or reversals, return to the mapping table in Adapt an existing strategy. Each case needs its own entry, exit, cancellation and position-scope checks. A successful compile does not supply those mappings.

Use Verify your setup on demo for the actual connected test. Follow the same future event through each stage:

  1. Strategy: the intended simulated entry or closing fill occurred.
  2. TradingView log: the corresponding message has the expected action and values.
  3. PineConnector: the message was received and its processing result matches the request.
  4. Demo account: the expected position, size and protection are present, with no duplicate or unintended affected trade.

If a stage is missing, record it as unverified. A profitable strategy report, a received webhook or a compiled script cannot fill in the missing evidence.

Write two short sentences for your chosen strategy: “It enters when…” and “It exits when…”. Then identify its alert event source, broker symbol, sizing unit and the positions its closing command can affect.

Show the answer for the course example

It requests a simulated long entry after a confirmed upward EMA cross while the simulator is flat. It requests a simulated full close after a confirmed downward cross while long. Its connector messages follow the fills, use the separately entered broker symbol and fixed lot size, and close matching buys within the EA’s scope. Broker stop and target orders can close independently, so the two position states must be checked separately.