Running Automated Strategies

This article explains how to run automated strategies in JForex.

In addition to manual trading, JForex offers the possibility to create and run automated trading strategies.

Once a strategy has been created and is ready for use, you can add it to the workspace, configure and launch it through the Strategies tab or the Navigator (in the lower left).

It is strongly encouraged to constantly monitor strategies. Before any strategy is used in live mode, you are advised to test it thoroughly in a demo environment. 

File Format

The trading platform uses two different file formats for strategies.

  • .java - source file of the strategy which allows to edit the strategy in the Strategy Editor. Before the strategy can be run or tested, it needs to be compiled first. This is done automatically when running or testing a strategy but can also be done manually. If the compilations was successful, the compiled file is saved with the same file name but file suffix .jfx (instead of .java) in the folder where the source file is stored.
  • .jfx - compiled strategy file ready for use. It is not possible to edit the strategy code.

NOTE: Visual JForex uses the file format .vfs. It is not possible to load these files in JForex. Visual JForex strategies need to be exported as a .java file. Alternatively and if the trading account is connected to the community account, the strategy can be built in Visual JForex (Compile > Build). The strategy then becomes available in the Visual JForex tab of the Open Strategy window in JForex.

Strategies Tab

The Strategies tab shows all strategies that are available in the workspace and offers possibilities to add, close, run, stop, edit strategies and change their parameters.

You can run a single strategy or multiple strategies in parallel, including running multiple instances of the same strategy with the same or different parameters.

To open the Strategies tab and launch a strategy:

  1. By default, the tab is open. Should it be closed, go to View in the menu bar at the top of the trading platform and select Strategies.
  2. The strategy tab should now be displayed in the tab area (next to other tabs such as Orders, Positions, Messages).
  3. Select your strategy from the list. If the strategy is not yet added to the workspace, click on the open button to add the strategy.
  4. Adjust the settings and parameters as required (more on the different options below).
  5. Click on the start button (Start Button).
  6. The Define Parameters window appears. This is where you set the variable values (as defined in the strategy code, e.g. instrument, slippage, amount etc.).
  7. Click on Run to launch the strategy.

Strategy Tab Overview

  • Execution Environment (1) - strategies can be launched on the local computer or the strategy server provided by the broker.
  • Start (2) - starts the strategy. If the strategy is not yet compiled, this is done upon starting the strategy.
  • Stop (3) - stops the selected strategy.
  • Stop all (4) - stops all strategies.
  • Edit (5) - opens the source file in the Strategy Editor (when source file available).
  • Compile (6) - compiles the strategy file.
  • Test (7) - opens the Historical Tester which is used for backtesting strategies.
  • Open (8) - allows to add new strategies to the workspace.
  • Delete (9) - deletes the selected strategy(ies) from the workspace.
  • Strategy Log (10) - opens the strategy log (can also be opened by going to Reports > Strategy Log)
  • Parameters (11) - opens the Define Parameters window and allows to create custom presets for the parameters.

Navigator

Most of the actions can also be performed in the Navigator.

Right-click Strategies or Custom , then click on Open Strategies to add new strategies to the workspace.

Strategy Tab Navigator 1

Once a strategy is added to the workspace, right-click the strategy name to access the available options.

Strategy Tab Navigator 2

Parameter Presets

Strategy Tab Parameters

You can either use the default parameter preset or create one of your own.

The default parameter preset is defined by the public fields in the strategy source code that are annotated by @Configurable.

To create a new custom preset:

  1. Click on the parameters button to open the Define Parameters window
  2. Change at least one of the parameters value.
  3. Click in the Preset name field and rename the preset.
  4. Click on the save button.

If you would like to remove or restore a preset, click on the remove or restore button respectively.

Execution Environment

There are two options for running a strategy:

  • Local run
  • Remote run

Local run is the default way of strategy execution and means that the strategy will be run on the user's workstation, allowing the use of local resources (like file system, libraries, other java classes, etc).

While Remote run cannot access the local resources, it has several advantages over Local run:

  • the Remote servers are located near by the Price Feed server i.e. a price delay is minimal,
  • the Remote servers are located near by the Orders Execution server i.e. a execution delay is minimal,

A remotely launched strategy can be stopped from any computer.

The number of strategy slots is limited but may be increased upon request.

The information on this web site is provided only as general information, which may be incomplete or outdated. Click here for full disclaimer.