Sentiment Strategy (LMAX)

This tool monitors the buy/sell exposure and open trades of an MT4 server's traders and mirrors them into LMAX.

This tool monitors the buy/sell exposure and open trades of an MT4 server's traders and mirrors them into LMAX.

Chocolatey package: CPlugin.CopyTrade.SentimentStrategy.LMAX.

How the strategy works

At StartTime the strategy starts counting buy and sell trades from the monitored pairs. It calculates the ratio between buys and sells (for example, 2 buys and 1 sell is 66.66% buy and 33.33% sell):

  • After N orders are counted (as set in RatioIn), the strategy can start opening a trade.
  • If the ratio is better than RatioBuy, it can open a sell trade.
  • If the ratio is better than RatioSell, it can open a buy trade.
  • The strategy stops and closes the order if the ratio drops below RatioOut.
  • The strategy stops at EndTime and closes the open trade.

The program creates and maintains a persistance.json file. Do not delete this file manually — it keeps state between restarts of the application.

The program can trace the current situation to a CSV file. In the CsvLogger section you can enable or disable this feature and adjust the time span. Once enabled, the program saves data to a journal.csv file.

To enable or disable all trading activity, use the ReadOnly parameter. With this parameter set to true, the program works as usual but actual trades are not sent to LMAX — a good way to test your settings before going live.

UseTimeRange — set to true if the program should respect StartTime and EndTime. If you set this value to false, the program counts trades indefinitely. To reset the counters, stop the program (press Q) and manually delete the persistance.json file from the application's folder.

The CalculationMode parameter has a default value of UsingClosedTrades:

  • With UsingClosedTrades mode, it calculates closed trades as described above.
  • With UsingOpenTrades mode, it calculates open trades from the very beginning. Working in this mode disables the TradeAfter parameter.
The program loads its settings only once, when it starts. Close the program before adjusting its settings.

Settings file example

{
  "CsvLogger": {
    "Enabled": true,
    "Period": "00:00:05"
  },
  "ReadOnly": false,
  "CalculationMode": "UsingOpenTrades",
  "StartTime": "09:00:00",
  "EndTime": "18:00:00",
  "UseTimeRange": true,
  "TradeAfter": 4,
  "RatioIn": 0.75,
  "RatioOut": 0.5,
  "Monitor": [
    "EURUSD",
    "EURUSDc",
    "EURUSD."
  ],
  "Trade": "EUR/USD",
  "Amount": 10.0,
  "SLOffset": 0.00050,
  "TPOffset": 0.00020,
  "TraceEachTrade": true,
  "TracePeriodically": false,
  "TraceEvery": "00:01:00",
  "MT4": {
    "Address": "127.0.0.1:443",
    "Login": 1,
    "Password": "***"
  },
  "LMAX": {
    "Url": "https://web-order.london-demo.lmax.com",
    "IsLive": false,
    "Login": "***",
    "Password": "***",
    "InstrumentsCsv": "LMAX-Instruments.csv"
  }
}