The Terms of Trade, very generally, is a ratio of the prices of a country’s exports to the country’s imports.
Investopedia’s definition of terms of trade:

What are ‘Terms of Trade – TOT’?

Terms of trade represent the ratio between a country’s export prices and its import prices. The ratio is calculated by dividing the price of the exports by the price of the imports and multiplying the result by 100.

But how exactly do you calculate the “price of exports and imports” of a country like, say Brazil, that has USD 190B of exports a year comprising surely thousands, if not more, of different products, and what to do about the changing quantities of each of those products every year? How do we understand the terms of trade in a way that doesn’t vaguely seem like the trade balance? The trade balance is the total value of exports minus imports, or net value of exports. Where $$p_i$$ and $$q_i$$ are the price and quantity of export product $$i$$ and $$p’_i$$ and $$q’_i$$ are the price and quantity of import product $$i$$:

$$\textrm{Trade Balance } = EX – IM = \sum_{i}^{}{p_i \cdot q_i} – \sum_{i}^{}{p’_i \cdot q’_i}$$

$$\textrm{A ratio vaguely like the trade balance } = \frac{EX}{IM} = \frac{\sum_{i}^{}{p_i \cdot q_i}}{\sum_{i}^{}{p’_i \cdot q’_i}}$$

The answer is that the terms of trade is a ratio of a price index of exports to the same price index of imports. The price index can be calculated by deciding on a base year to compare the year in question. For example, for the prices of products in the year in question, we sum the values of exports for each product in that year, i.e. $$\sum_{i} {p_{i,n} \cdot q_{i,n}}$$ where $$i$$ is the index for each different product and $$n$$ is the year in question. For the prices of products in the base year $$0$$, we take the price of each product $$i$$ in that base year $$p_{i,0}$$ multiplied by the quantity of that product $$i$$ in the year in question $$n$$ instead of the base year $$0$$, $$q_{i,n}$$. In other words, we fix the quantity of each product $$q_i$$ to the quantity of each product in the year in question $$q_{i,n}$$ so that we are strictly comparing prices between year $$n$$ and $$0$$ and not letting changes in quantity $$q$$ get in the way. This is the Paasche index – always keeping $$q_{i}$$ as $$q_{i,n}$$.

Another way we can do this is: for the prices of products in the year in question $$n$$, we sum the prices of each product in that year $$p_{i,n}$$ multiplied by the quantity of each product from the base year $$q_{i,0}$$. For the prices in the base year $$0$$, we take the price of each product $$i$$ in that base year $$p_{i,0}$$ multiplied by the quantity of that product $$i$$ also in the base year $$0$$, $$q_{i,0}$$. So this time, instead of fixing the quantity of each product to the year in question $$n$$, we fix the quantity of each product to the base year $$0$$. This is the Laspeyres index.

Paasche index:

$$P_{\textrm{Paasche}} = \frac{\sum_{i}{p_{i,n} \cdot q_{i,n}}}{\sum_{i}{p_{i,0} \cdot q_{i,n}}}$$

Laspeyres index:

$$P_{\textrm{Laspeyres}} = \frac{\sum_{i}{p_{i,n} \cdot q_{i,0}}}{\sum_{i}{p_{i,0} \cdot q_{i,0}}}$$

Thus, by using such a price index calculation we “cancel out” the effect of changing export quantities or import quantities so that we are only looking at the change of price of exports or imports between two time periods. With a base year $$0$$, we can calculate the price index for exports in year $$n$$, the price index for imports in year $$n$$, and then divide the former by the latter to achieve the terms of trade for year $$n$$:

$$\textrm{Terms of Trade} \ = \frac{P_{\textrm{Paasche, exports}}}{P_{\textrm{Paasche, imports}}} \ \textrm{or} \ \frac{P_{\textrm{Laspeyres, exports}}}{P_{\textrm{Laspeyres, imports}}}$$

Note: If prices have gone up from year $$0$$ to year $$n$$, it’s likely that the quantities have adjusted between year $$0$$ and year $$n$$ by substituting other things for those products whose prices have risen or by simply just decreasing consumption of those products in order to deal with the price shock. For example, take a look at the ratio of value of products in year $$n$$ to the ratio of value of produces in base year $$0$$:

$$\frac{\sum_{i}{p_{i,n} \cdot q_{i,n}}}{\sum_{i}{p_{i,0} \cdot q_{i,0}}}$$

Compared to the base year, the value in the numerator from year $$n$$ have a new price $$p_{i,n}$$ and a new quantity $$q_{i,n}$$. The year $$n$$ quantity $$q_{i,n}$$ has adjusted to the new price of $$p_{i,n}$$ and thus if the price in year $$n$$ has increased from the price in year $$0$$, we expect the new quantity to be lower than the base year quantity $$q_{i,n} < q_{i,0}$$. Thus, the Laspeyres index overstates the price increase (because the quantity in the numerator $$q_{i,0}$$ is from before the price increase, from before adjusting to the new higher prices, and thus is larger than intended) and the Paasche index understates the price increase (because the quantity in the denominator is $$q_{i,n}$$, which is from after the price increase and thus $$q_{i,n}$$ is larger than intended, making the index value smaller than intended). If prices have decreased from year $$0$$ to year $$n$$, the quantity should increase from year $$0$$ to year $$n$$ to take advantage of those lower prices. Thus, the Laspeyres index value will be larger than intended (the quantity in the numerator $$q_{i,0}$$ is smaller than intended because time $$0$$ is before the quantity adjustment that would take advantage of lower prices; thus, the numerator is larger than intended) and thus understates the price decrease and the Paasche index value will be smaller than intended (the quantity in the denominator $$q_{i,n}$$ is larger than intended because time $$n$$ is after the quantity adjustment to take advantage of lower prices and thus the denominator is larger than intended; thus, the index is smaller than intended) and thus overstates the price decrease.

A terms of trade chart quantitatively summarizes the change in prices of a country’s exports and imports.

What is the conceptual difference between the

$$\textbf{Terms of Trade} \ = \frac{P_{\textbf{Paasche, exports}}}{P_{\textbf{Paasche, imports}}} \ \textbf{and}$$

$$\textbf{Current Account} \ = \sum_{i}{p_{i,n,exp} \cdot q_{i,n,exp}} – \sum_{j}{p_{j,n,imp} \cdot q_{j,n,imp}} \ \textbf{?}$$

The Terms of Trade can be thought of as a weather forecast for the trade situation of a country by taking some base year $$0$$ in the past and the current present time as year $$n$$. Data on the prices of goods and services on the world market at the current time for year $$n$$ are theoretically always available to us in the present time. Thus, we can always create an up-to-date Terms of Trade data point for the present. However, the Current Account is trickier to have in the exact present time because the exchange of goods and services takes time and surely there is more time lag between the act of trading goods and services for payment and the data of that act being available (to calculate the present Current Account) than the time lag between the price-setting or price-reporting for goods and services and the data of that price being available (to calculate the present Terms of Trade). So if the Terms of Trade of a country changes, that is a certain kind of forecast for that country’s Current Account for that year. But how?