Strategies
This manual walks you through adding, compiling, configuring, and launching a trading strategy on JForex4 — either from JCloud or from your local storage, and either on your own computer (Local run) or on your broker's strategy server (Remote run).
1. Open the Strategies Panel
- If the Strategies tab is not already visible, open it from the top menu: View → Strategies.
- The tab appears in the tab area alongside other panels such as Orders, Positions, and Messages.
2. Add a Strategy to the Workspace
Click Open in the Strategies panel toolbar to add a strategy to your workspace. You have two sources:
- From JCloud — browse Dukascopy's strategy repository and add a ready-made strategy directly.
- From local storage — use Import first to bring a
.javaor.jfxfile from your computer into JCloud, then open it from the list.
Tip: The same actions are available in the Navigator panel — right-click Strategies (or Custom) and select Open Strategies.
3. Compile the Strategy
JForex4 strategies exist in two file formats:
| Format | Description |
|---|---|
.java |
Editable source file. Must be compiled before it can run. |
.jfx |
Compiled, ready-to-run file. Cannot be edited unless the source .java is available. |
To compile manually, do either of the following:
- Click the Compile button in the Strategies panel toolbar, or
- Right-click the strategy in the Strategies list and select Compile.
Note: Compilation also happens automatically the first time you click Start, so a manual compile step is optional — but doing it first lets you catch errors before configuring parameters.
4. Configure the Strategy Parameters
- Select the strategy in the list and click the Parameters button (or the Start button, which opens the same dialog) to open the Define Parameters window.
- Set the values for each field exposed in the strategy code (e.g., instrument, amount, slippage, stop loss/take profit levels) — these correspond to the fields marked
@Configurablein the source. - (Optional) Save your settings as a reusable preset:
- Change at least one parameter value.
- Enter a name in the Preset field.
- Click Save.
- Saved presets can later be removed or restored from the same window.
5. Choose the Execution Mode: Local or Remote
Right-click the strategy in the Strategies tab and select the execution mode before (or while) starting it.
| Mode | Runs on | Key characteristics |
|---|---|---|
| Local run | Your own workstation | Default mode. Can access local resources — file system, external libraries, other Java classes. Stops if your platform/computer disconnects. |
| Remote run | Broker's strategy server | No access to local files or charts (IContext.getChart() returns null); the strategy must subscribe to all instruments it needs on start. Lower latency to price feed and order execution servers. Can be stopped from any computer, since it isn't tied to your machine. Number of available strategy slots is limited. |
Note: If you plan to run remotely, make sure your strategy code doesn't depend on local files, charts, or custom indicator classes defined outside the strategy file itself — these aren't available in the remote environment.
6. Start the Strategy
- Click the Start button for the selected strategy.
- Confirm/adjust parameters in the Define Parameters dialog if it appears.
- Click Run to launch it.
Once running, you can:
- Stop an individual strategy, or Stop all to halt every running strategy at once.
- Edit the strategy (opens the source in the Strategy Editor, if the
.javafile is available). - Monitor activity via the Strategy Log (Strategies panel or Reports → Strategy Log).
Best Practices
- Always test a new or modified strategy thoroughly in a demo account before running it live.
- Monitor running strategies continuously — automated execution doesn't remove the need for oversight.
- Use the Historical Tester (the Test button in the Strategies panel) to back-test a strategy's logic against historical data before going live.
- Keep separate parameter presets for demo testing vs. live trading to avoid accidentally launching with the wrong settings.