Skip to main content

Running Strategies

A running strategy lives in the CrossTrade add-on inside NinjaTrader. CrossTrade's website starts it, watches it and stops it, but the strategy evaluates on your computer, against the bars NinjaTrader builds, and places its orders there. NinjaTrader has to stay open and connected for it to trade.

An indicator starts, runs and stops the same way. It needs no account and places no orders itself, so the account, position and order sections below apply to strategies only. While NinjaTrader is closed, an indicator does not update and its alerts do not trigger.

Starting a strategy​

Open the strategy and press Start. Starting takes a few seconds: CrossTrade loads recent history, the add-on compiles the strategy and warms it up on that history, and then it switches to live bars. The status shows each step while it happens.

A start is refused, with the reason in plain words, when:

  • NinjaTrader is not connected, or the add-on is older than v1.14.0.
  • No account is picked. A strategy never guesses which account to trade.
  • The account already holds a position in this contract that the strategy did not open. Close it in NinjaTrader first.
  • Another strategy or automation is already trading this contract on this account.
  • You are already running the most strategies your plan allows (10 at a time).
  • The script has not converted, or you have no paid plan or trial.

Every entry a strategy places goes through the same checks as your CrossTrade webhook orders, so your account rules apply to it. With Opposing Position Protection on, an entry that would open the opposite side of a position you hold in the same market on another account is refused (ES and MES count as the same market). The strategy notes the refusal in its events and acts again at its next signal.

How it places orders​

Every order a strategy wants (an entry, an exit, a stop or target, a change to a working order, a cancel) goes out as a standard CrossTrade command, the same PLACE, CHANGE and CANCEL your TradingView webhooks send, marked as the strategy's own. That is why your account rules, rate limits and the kill switch apply to it exactly as they do to a webhook.

The strategy decides in NinjaTrader and the command makes a round trip through CrossTrade before NinjaTrader places it. If CrossTrade does not answer in time, the two kinds of order are treated differently, so a position is never left without its protection:

OrderIf CrossTrade does not answer
Entry (opens or adds to a position)Waits up to 60 seconds, then is dropped and noted in the events. The strategy acts again at its next signal
Exit, stop, target, change or cancelNinjaTrader places it itself after 2.5 seconds

A stop and target from the same strategy.exit are linked one-cancels-other at the broker, so whichever fills first cancels the other even if CrossTrade is unreachable.

Automatic starts​

Turn on Auto start (in My strategies, at the top of the strategy's page, or under Settings) for a strategy you want running whenever NinjaTrader is up. CrossTrade then starts it each time the add-on connects, so you do not have to come back to the website after you restart NinjaTrader or your computer.

Watching a strategy​

The strategy's Overview shows the live picture.

The Now line says in one sentence what the strategy is doing, for example "Waiting for an entry. Checked at each 5-minute bar close (next in 2:41)", "Long 2 at 6801.25, up $7.50. Stop 6791.25 is 43 ticks away.", or "Warming up: 37 of 400 bars." Prices and distances update with the market while you watch.

The chart shows the strategy's bars, its plots, its working orders and its trades for the time it has been running. Conditions lists the conditions guarding its orders and whether each is met. Recent actions lists what it did last, such as "Closed long 2 at 4998.00 (stop)."

This run in My strategies and on the Overview counts only the trades the strategy made live, with real fills. The trades it simulated on history while warming up are not counted.

Warnings that need you​

Most of the time a running strategy needs nothing from you. Three situations do.

"Holding long 2 with no stop order working." The strategy holds a position with no stop of its own at the broker. Nothing will close that position for you. Protect it or close it in NinjaTrader right away.

"Needs a check before it trades again." The broker reported something the strategy cannot reconcile on its own, for example an order whose outcome is unknown, an order rejected for a reason other than price, or a trade placed on the same contract and account from outside the strategy. The strategy stops placing new orders. Check the account in NinjaTrader, then stop and start the strategy. If the start then says an earlier run did not settle its broker accounting (a position that disappeared without a fill, for example when NinjaTrader reset its connection), restart NinjaTrader first: CrossTrade will not guess which fills belong to the old run, and the restart clears it.

"Stopped by an error." The strategy hit an error in its own logic and stopped evaluating. The reason is in its events. Orders already at the broker stay there.

Stopping a strategy​

Press Stop on the strategy's page. Stopping ends the strategy's evaluation and cancels its working entry orders. Its stop and target orders stay at the broker, and nothing is closed: if the strategy held a position, you still hold it, protected by the same orders. A stopped strategy does not start again by itself unless Auto start is on and NinjaTrader reconnects.

To close the position as well, do it before you stop: use Close the position in the strategy's menu (the ⋯ button). It closes the open position on the strategy's account and contract at market.

A stopped strategy still owns its position

While a stopped strategy's position or its stop and target orders are still open, CrossTrade's own close buttons, webhook orders and other CrossTrade orders on that contract and account are refused, so nothing fights the strategy's orders. Close the position and cancel those orders in NinjaTrader itself. Once the contract is flat with no working orders on that account, CrossTrade orders work again.

When NinjaTrader restarts​

A strategy keeps no state on your computer between runs, so when the add-on connects again, CrossTrade starts each strategy that was running (and that you did not stop) again on fresh history, once the account itself is connected:

  • If that history ends holding exactly the position your account holds, the new run takes the position over. It first cancels the orders the earlier run left working, then places its own stop and target. As on TradingView, the strategy prices that trade from its own history, so its entry price, open profit and any stop or target measured from the entry can differ from your actual fill. That trade is not counted in Performance.
  • If the account is flat, it cancels any orders the earlier run left working and starts flat. It never places a trade just to match its history; it waits for its next signal.
  • If the account holds anything else, it stays stopped and says why. The earlier run's stop and target orders stay working in NinjaTrader, so the position is still protected. The strategy's page then offers Close the position and start: after you confirm, CrossTrade closes that position at market, cancels the contract's working orders and starts the strategy flat. You can also close the position and cancel those orders in NinjaTrader yourself, then press Start. This can happen after a CrossTrade update too, because the strategy converts again before it rebuilds its history.

The same choice appears when Start is refused because the account already holds a position in the strategy's contract. It never closes a position another strategy manages.

A strategy you stopped yourself stays stopped.

Performance​

The Performance tab shows each run's closed trades, net result, win rate, profit factor and drawdown, built from the run's real fills and the commission set in your script. It keeps its history after a strategy stops.

Deleting a strategy​

Stop a strategy before you delete it. Deleting removes it from My strategies and does not touch your NinjaTrader account: trades it made stay in your account history, and orders or positions it left are yours to manage in NinjaTrader.