Soon available

Not on the Chrome Web Store yet

ProRealCode Studio is on its way. As soon as it is published, this button will take you straight to its Chrome Web Store page.

Chapter 19 · Part IV — Alerts and strategies

Arm a strategy, and it follows the live chart.

A backtest looks back. An armed strategy keeps going: at each new bar it reads the chart again, and every order it fills rings a chime and can leave as a signal for your own program. It never sends an order to a broker.

The top of the Strategies window: the switch Run strategies in realtime, off, and two lines of explanation cut at the right edge.
The switch at the top of the Strategies window. Its two lines, in full: “A strategy runs from this page, on this chart's quote stream. It needs this ProRealTime tab open — minimised is fine, closed is not. Nothing runs in the background.” and “An armed strategy places no real order. Each fill is sent as a JSON signal to the webhook in ⚙ Preferences → Alert, and what happens next is your receiver's business.”

What an armed strategy does

  • Reads the chart again at each new bar.
  • Keeps its P&L up to date in the Strategies window.
  • Plays a chime at each fill.
  • Sends each fill to your webhook, if you set one (chapter 17).

What it does not do

  • Place an order with your broker, or anywhere else.
  • Run with the ProRealTime tab closed.
  • Survive a reload of that tab: arm it again.
Before you startYou have a strategy on the chart and know its results window (chapter 18). For signals, set the webhook address first (chapter 17).
ProRealCode StudioUser guide · Chapter 19
01 · Task · Turn it on and arm

One switch for all, then one click per strategy.

Real time is off until you allow it. The switch allows it; arming is what starts one strategy.

  1. Open the Strategies window (the candle icon on the rail) and switch on “Run strategies in realtime”.The same switch is in Preferences, tab “Backtest”, under “Realtime”.
  2. On your strategy's row, click the triangle at the right end: “arm this strategy for realtime”.The second line of the row reads “armed — realtime”, in green. A “signals” count joins “P&L” and “trades”, and the Strategies icon on the rail shows how many strategies are armed.
  3. To stop it, click the same button again: “stop this strategy — orders stop firing”.The row reads “backtest only” again.
You seeIt means
“backtest only”Not armed. The strategy still shows its results on the past.
“armed — realtime”Armed. It acts on each new bar of the chart it watches.
“signals” and a numberThe fills it has sent as signals since you armed it.
“Realtime strategies are off — turn them on in ⚙ Preferences → Backtest”You clicked the triangle with the switch off. Switch it on first.
What disarms a strategySwitching off “Run strategies in realtime” disarms every strategy at once. Editing the code and running it again, reapplying it, or reloading the ProRealTime tab disarms that strategy: arm it again when you are ready.
ProRealCode StudioUser guide · Chapter 19
02 · Task · Follow the fills

A candle closes, the code decides, the next one fills.

1 · the candle closes2 · the next one opens the code decidesthe order fills a two-note chimethe fill, sent to your webhookthe P&L and “signals” update
Illustration. The same timing as a backtest (chapter 18), live: the fill, and everything it triggers, comes when the next candle opens.
Preferences → Backtest → RealtimeAt firstEffect
Run strategies in realtimeoffAllows arming. Off disarms everything.
Send each fill to the webhookonEach fill leaves in the same JSON object as an alert, to the address of the tab “Alert” (chapter 17). Off, the strategy stays armed and sends nothing.
Sound on each fillonA rising two-note chime, unlike the single beep of an alert, so you can tell a fill from an alert without looking. Switching it on plays it once.
The first signals after armingWhen you arm a strategy, the fills already in its run on the past are sent to the webhook too, once each; the chime rings only for a fill on the newest bar. Have your receiver look at barTime and skip the fills that are not recent.
ProRealCode StudioUser guide · Chapter 19
Chapter 19 · In short

Armed, a strategy watches. It does not trade.

Switch on “Run strategies in realtime”, then arm one strategy with its triangle. From then on, at each new bar, it fills its orders on paper, rings, and sends each fill to your webhook. Whatever happens next, a real order included, is up to the program that receives the signal.

Does an armed strategy place orders with my broker?

No. “An armed strategy places no real order.” It only sends a signal, if you set a webhook.

I closed the tab. Is the strategy still running?

No. It runs in the ProRealTime tab and nowhere else. A minimised window is fine; a closed tab is not.

Why is the realtime result not the backtest's?

The results window marks a live run “Realtime”: it saw the last candle while it was forming. Its figures are not those of a backtest of the same bars. “Completed runs” marks such a run with ◉.

My receiver got old trades right after I armed.

Those are the fills already in the run, sent once. Filter on barTime.

The strategy shows “backtest only” again.

It was disarmed: a code change, a reload, or the switch turned off. Arm it again.

Can I keep it armed but silence the webhook?

Yes. Switch off “Send each fill to the webhook”. The strategy goes on running and sends nothing.

No investment advice. An armed strategy simulates orders on live prices and reports them. Its fills and P&L are not a forecast, not investment advice and not a recommendation to buy or sell anything. What a program you connect does with its signals is your decision and your responsibility.

Next

Chapter 20 · Optimizing a strategy

Try every combination of a strategy's settings, rank them, and learn to distrust the best one.

ProRealCode StudioUser guide · Chapter 19
ProRealCode ProRealCode
Loading...