# How to use Mida with cTrader

A live or demo trading account can be created at of one the many brokers supporting cTrader, for example Pepperstone (opens new window), FxPro (opens new window), Axiory (opens new window), ICMarkets (opens new window) or RoboForex (opens new window).

# Connection

How to connect to a cTrader account.

import { connect, } from "@reiryoku/mida";

const myAccount = await connect("cTrader", {
    clientId: "...",
    clientSecret: "...",
    accessToken: "...",
    accountId: "...",
});

For more examples, read the documentation.

# Connection credentials

A broker account is the first requirement to get started with Mida and cTrader, the second and last requirement is providing a clientId, clientSecret, accessToken and cTraderBrokerAccountId.

  1. Create a cTrader trading account from the broker website
  2. Visit cTrader Open API (opens new window) and login
  3. Go to the "Applications" page
  4. Create a new application
  5. After the creation, wait for the application to be approved, this may take up to 48 hours
  6. Pressing "View" under credentials will reveal the clientId and clientSecret of the application
  7. Once the application is activated, go to the "Playground" page
  8. Make sure to select the "Trading" scope, then press "Get Token" and select your trading account
  9. After the confirmation, the accessToken will be revealed
  10. To retrieve the cTraderBrokerAccountId press on "Trading Accounts", the cTraderBrokerAccountId is the "accountId" revealed in the JSON message

At this point it's possible to use Mida with the authorized broker account.

# Node.js cTrader API

The cTrader API is fully supported by Mida and can be used with all broker accounts through Node.js/JavaScript or other programming languages, read the documentation for more examples.

# Something is not working?

If something is not working as expected, create an issue (opens new window) on GitHub.