A contract for difference, or CFD, is an agreement between a trader and a broker to exchange the difference in an asset's price between the time the contract is opened and the time it is closed. If you buy a CFD on the FTSE 100 at 8,200 and close it at 8,250, the broker pays you the difference, 50 index points multiplied by the contract's value per point. If the index falls to 8,150 instead, you pay the broker the same way.
At no stage do you own the shares in the index, the ounces of gold or the currency. You hold a contract whose value tracks the price. That is what makes it possible for a retail trader to trade the German stock index or gold from a single MetaTrader 5 account with a few thousand pounds in it.
What the contract specifies
Every CFD has a contract specification that the broker publishes, and in MetaTrader 5 you can read it by right-clicking a symbol in the Market Watch window and choosing Specification. The important lines are:
The contract size, which is what one lot represents. For gold this is usually 100 troy ounces. For an index it is usually one contract worth a stated amount per index point, and that amount varies from broker to broker.
The tick size and tick value, which say how far the price moves in one step and what that step is worth per lot.
The minimum volume, the volume step and the maximum volume, which set the smallest and largest positions you can open and the increments between them.
The margin requirement and the swap rates, which are covered on their own pages.
The trading hours, which for indices and gold are shorter than for currencies and include daily breaks.
CFDs against the underlying market
A CFD price follows the underlying market closely but is set by the broker, who adds the spread and, for some products, adjusts the price for dividends and financing. Two brokers will quote slightly different prices for the same index at the same moment. Over a single trade the difference is small. Over thousands of trades, and especially for strategies that depend on precise entry levels, it can add up, which is why the same EA produces different results at different brokers.
CFDs are leveraged products, and in the UK they are regulated by the FCA, which caps the leverage a retail client can use and requires brokers to protect clients from losing more than their account balance. Those rules are the reason the risk warning on every broker's site says that most retail accounts lose money. They do.
You buy 0.1 lots of gold at $2,400. At a contract size of 100 ounces, 0.1 lots is 10 ounces, so the position is worth $24,000. Gold rises $15 to $2,415. Your profit is $15 multiplied by 10 ounces, which is $150, less the spread and any commission. If your account is in pounds, the broker converts that at the prevailing rate.
An EA that trades several markets has to size each position from the contract specification of the symbol it is trading, not from a fixed assumption. One lot of EUR/USD, one lot of gold and one lot of the US 500 index are three entirely different amounts of exposure. A properly built EA reads contract size, tick value and volume step from the broker at run time and works out lots from the risk it intends to take. If an EA asks you to enter a fixed lot size for every market, that is a warning sign.
The same applies to trading hours. An EA that expects a daily bar to close at a particular time must handle the broker's own session times for each market, including the daily break on index CFDs and the differences between brokers' server clocks.