Content:
How to get a license for free!
More →
Crypto exchange
You click the Buy button and see how the price instantly changes — but where does the platform even get this number from? Who decides that EURUSD is worth exactly that much, and not otherwise, and why can the price on one account momentarily differ from the price on another? The entire market is behind these issues: the bids of buyers and sellers, the glass of bids, market makers and liquidity flows. Let's analyze the price of a financial instrument in parts: how does an equilibrium price arise from supply and demand, how does a Bid differ from an Ask, how the price is formed on the stock exchange and at an over-the-counter broker, how ticks turn into candles, and how all this affects the real outcome of a transaction in MetaTrader 5.
The price of a financial instrument is the result of the coincidence of supply and demand at a particular time. This is not a property of the graph or a constant embedded in the platform. The price exists only because some market participants are willing to buy an asset at one rate, while others are willing to sell it at another, and at some point these interests meet.
Several important consequences follow from this definition:
It is useful to immediately separate price from related concepts. The quote is the published value of the best buy and sell prices that the trader sees. The transaction price is the price at which a particular order was actually executed. They are related, but not identical, and it is from this difference that the spread and slippage grow. Before delving into the mechanics, it is worth refreshing the general context of the market in the material What is Forex, and here we will analyze exactly how the price is born.
The basic model is simple. Demand is a set of desires to buy: the lower the price, the more willing there are. An offer is a set of desires to sell: the higher the price, the more willing there are to sell. At the intersection of these two interests, a equilibrium price arises — one at which the volume of those who want to buy approximately coincides with the volume of those who want to sell.
In the real market, this model does not work in a vacuum, but as a continuous auction. The price is not "calculated by a formula" — it is discovered in the process when the flow of buyers' requests collides with the flow of sellers' requests. A new large buyer shifts the balance up, a large seller moves down, and together they make the price constantly move.
| Event | What happens to the balance | How price reacts |
|---|---|---|
| Demand is growing (more buyers) | Preponderance on the buying side | The balance is shifting upward |
| The supply is growing (more sellers) | The advantage is on the selling side | The balance is shifting downward |
| Supply and demand are equal | Balance of power | The price fluctuates in a narrow range |
| Simultaneous surge both there and there | Fighting for levels | Volatility is growing |
Hence the key point that is important to understand: it is not the chart itself that moves the price, but the imbalance between the flow of purchases and sales. If there are more people willing to buy than sell, sellers raise their prices, and the new level is fixed as the new market price. All technical indicators only describe the trace of this process, not its cause.
Equilibrium is the result, and its "building material" is the usual orders. Each order contains two important characteristics: the price at which the participant is ready to make a deal, and the volume that he is ready to buy or sell.
There are two types of applications:
When a market buy order and a limit sell order meet at the same price, the transaction is completed. Each transaction "eats up" part of the volume set, and if the flow of market purchases exceeds the volume of limit sales at the best price, buyers are forced to take the next, higher level. This is how the price moves up step by step. The reverse situation — market sales versus limit purchases — pushes the price down.
Almost all participants are divided into two categories:
| Category | Role | Price impact |
|---|---|---|
| Market takers (market orders) | They take the liquidity out of the glass | They move the price by "eating" the levels |
| Market makers (limit orders) | They put liquidity in a glass | Create a "cushion", smooth out the movement |
It is important to understand that one large order does not always move the market as much as many small ones. If there is a dense limit "wall" in the way of a large market order, the price will move slightly. If there is little liquidity, even a modest volume can pass dozens of points with almost no resistance.
Every time different orders co-exist on the market, the instrument always has at least two key prices.
Bid is the best price at which participants are willing to buy. For a trader, this is the price at which he can sell the instrument.
Ask is the best price at which participants are willing to sell. For a trader, this is the price at which he can buy a instrument.
The Ask is always higher than the Bid. The difference between them is called the spread — this is the fee for the instantaneous transaction and the main cost for the trader.
| Quotation of the instrument | Price | What does it mean for a trader |
|---|---|---|
| Bid | 1.08500 | The asset can be sold at this price |
| Ask | 1.08512 | You can buy an asset at this price |
| Spread | 1.2 points | Transaction entry and exit costs |
Why is there a difference at all? Because the buyer and seller have different interests. The buyer would like to buy cheaper, the seller would like to sell more expensive, and their meeting costs money to those who provide liquidity. That is why you see a small disadvantage immediately after entering the transaction: for you, the "zero" result does not come at the entry price, but after passing the price by the amount of the spread.
One of the most frequent sources of confusion is the identification of the quote and the price of the last transaction. These are different things.
The Last transaction price is the price at which the transaction actually took place. It shows exactly where the buyer and seller met at that moment.
A quote is a pair of the best Bid and Ask prices displayed in a glass. It does not reflect the "last deal", but the intentions of the participants right now.
| The concept | What shows | Special Feature |
|---|---|---|
| Last transaction price | Where was the last real deal | It may not change for a long time with a sluggish market |
| Bid | Best purchase price | Updated as requests change |
| Ask | Best selling price | Always above the Bid |
| Mid (Mid) | (Bid + Ask) / 2 | The benchmark of the "average" price of the instrument |
The practical meaning of this difference is noticeable on low-liquid instruments and in quiet hours. There, the price of the last transaction may "freeze" because there are simply no transactions, and the Bid and Ask have already shifted following the changed bids. Therefore, the correct benchmark for the current market situation is the actual Bid and Ask, and their mid is often used for analysis.
The market price could not exist without liquidity — the ability to quickly buy or sell an asset without strongly influencing its price. The main liquidity providers are market makers: banks, brokers, and specialized firms that constantly hold buy and sell orders in a glass.
The market maker earns money on the spread and turnover, and in exchange takes on risks: he is obliged to quote both sides of the market and is ready to execute transactions even when the flow is one-sided. The more market makers there are and the larger their volumes, the denser the liquidity cushion and the more resistant the price is to sharp market orders.
That is why the same pair behaves differently: during the hours of the intersection of London and New York, liquidity is at its maximum, and at night or on weekends it drops, and the price may move unnaturally sharply on a small volume. A participant who ignores the state of liquidity risks getting a much worse performance than expected.
The price cannot change arbitrarily: Each instrument has a minimum price step, which is the smallest value it can move by. Each such change is recorded as a tick — a new price value with a timestamp, and in MetaTrader 5 also with information about the volume.
A tick is an atom of market information. Everything else is built from ticks: current quotes, charts, and candlesticks. The differences in the "price" of instruments are largely explained by their pitch: for some pairs it is 0.00001, for others it is 0.001, and for individual instruments it is different.
| The concept | Meaning | Example |
|---|---|---|
| Tick | One price update with time and volume | Bid changed from 1.08500 to 1.08501 |
| Minimum step (Point) | The smallest possible price change | 0.00001 for a five-digit pair |
| Tick volume | The amount that has passed in this update | Shows activity at a specific moment |
| Tick frequency | How many updates per unit of time | Indirect indicator of activity and liquidity |
The tick volume deserves special attention. Unlike the exchange volume, which is accurate, the tick volume of an over—the-counter broker is a counter of price changes, not real lots. It is not equal to the "trading volume" in the strict sense, but it shows activity well: when there are many ticks, the market is lively and liquid, when there are few ticks, the movement can be deceptive.
The exchange's pricing mechanism is as transparent and centralized as possible. All orders are stacked in one glass of orders (order book), where the best prices and volumes at each level are visible. The price is determined by the meeting of bids according to the rules that are the same for all participants.
Key mechanisms of exchange pricing:
The main advantage of the exchange is a single price and accurate volume: all participants see the same glass, and the number of transactions and their volumes are fixed unambiguously. This makes the stock data "clean" and understandable for analysis. That is why exchange-traded instruments (stocks, futures, and some ETFs) are valued by traders who want to see real supply and demand.
The over-the-counter market (Forex, CFD) works differently. There is no single exchange and a single glass here: the price is formed from the flow of quotations that the broker receives from its liquidity providers — banks, market makers and aggregators.
The mechanics look like this:
| Aspect | Exchange | Over-the-counter broker |
|---|---|---|
| Price source | A single glass of applications | Aggregation of the flow of quotes from suppliers |
| Single price | Yes, for all participants | It may vary slightly from broker to broker |
| Volume | Accurate, real | Ticked, not always equal to real lots |
| Transparency | High | Below; depends on the execution model |
| Spread | Determined by the glass | Depends on the broker's liquidity and conditions |
Hence, an important practical conclusion: two traders at different brokers may see slightly different quotes on the same instrument, and this is normal, not a "mistake". The price on the over—the-counter market is always the result of aggregation of a specific set of sources, with a specific margin and specific performance conditions.
Since the price is a balance of supply and demand, it can be moved by any events that change the intentions of the participants. In practice, the main drivers are:
It is important to understand that the price reacts not only to the fact of the event itself, but also to the difference between expectation and reality. If the market was waiting for one thing and got another, the movement can be especially sharp. Therefore, at the time of publication, the spread widens, liquidity temporarily "disappears", and slippage becomes especially likely — this is a direct consequence of the instantaneous struggle of applications.
The candle on the chart is not something primary, but the result of the aggregation of ticks over a selected time interval. Each timeframe collects its own set of ticks and "compresses" them into one bar.
The logic of candle construction is as follows:
That is why a candle is an average, "compressed" representation of reality. There could be dozens of sharp jumps inside one bar, but you can only see their extreme points on the chart. Hence the consequence: the smaller the timeframe, the closer the chart is to the real tick flow, and vice versa — on the daily chart, a huge volume of movement is packed into one candle.
| Timeframe | How many ticks are there in the bar | What the trader sees |
|---|---|---|
| M1 | A little bit, in detail | A lot of "noise" and small movements |
| H1 | Bigger, smoother | The main intraday pattern |
| D1 | Very much, in general | The overall picture and trends |
The practical conclusion is simple: you cannot judge the market only by a "beautiful" candle, without realizing that there is a whole stream of ticks hidden inside it. To enter a trade, professionals often go down to the lower timeframes to see the real structure of the movement, from which the senior candle gathered.
If the market has two prices, the result of the transaction always depends not only on the direction of movement, but also on the costs. The two main ones are spread and slippage.
Spread is the difference between Ask and Bid. You buy by Ask, and close the sale by Bid, so immediately after entering you are in the red by the amount of the spread. To simply go to zero, the price must travel at least this distance in your direction.
Slippage is the difference between the price you expected and the price at which the order was actually executed. It occurs when there is not enough liquidity at the required level: for example, in the news, the price "slips" past your request, and execution is worse.
| Cost | When it occurs | How does it affect the result |
|---|---|---|
| Spread | On every trade | Immediately creates a slight disadvantage when entering |
| Slippage | When there is a shortage of liquidity, on the news | Execution is worse than expected, especially for stop orders |
| Spread expansion | On low liquidity and volatility | Dramatically increases the cost of entry and exit |
That is why the "ideal" price on the chart and the actual result of the transaction may differ markedly. A trader who considers only the direction of movement and ignores the spread and slippage is faced with "unexplained" losses. This effect is especially important in automated trading, where dozens of trades multiply costs.
The price seems chaotic because it reflects the simultaneous actions of thousands of participants with different goals, information, and horizons. Added to this are costs and heterogeneity of liquidity. The result is a system where the cause of each movement exists, but is not always observable and not always predictable.
What follows from this practically:
This is not a reason to consider the market random. This is a reason to work probabilistically: build scenarios, limit risk, and evaluate the outcome over a long series of trades, rather than one successful or unsuccessful one. Understanding how the price is formed protects you from the illusion of predictability where there is none.
MetaTrader 5 allows you to programmatically receive Bid, Ask, and the latest price, calculate the midpoint and spread, and evaluate market activity by ticks. This is a basic skill for any Expert Advisor who makes decisions based on price. Below is a compact and correct example on MQL5, which solves several tasks at once: it receives current quotes, calculates the spread, the midpoint of the price and the strike price, taking into account the spread, and also returns tick data.
// =============================================================================================== //
// = Get the current quotes of the instrument: Bid, Ask, Last and rate the spread = //
// =============================================================================================== //
void OnStart()
{
MqlTick tick; // a structure that stores the data of the last tick
// === requesting the last known tick for the current symbol ===
if(!SymbolInfoTick(_Symbol, tick))
{
Print("Couldn't get tick data for ", _Symbol);
return;
}
double bid = tick.bid; // best purchase price
double ask = tick.ask; // best selling price
double last = tick.last; // last transaction price
double point = SymbolInfoDouble(_Symbol, SYMBOL_POINT); // minimum price step
int digits = (int)SymbolInfoInteger(_Symbol, SYMBOL_DIGITS); // number of quotation marks
// === spread in points ===
double spread_points = (point > 0.0) ? (ask - bid) / point : 0.0;
// === the midpoint of the price between Bid and Ask ===
double mid = (bid + ask) / 2.0;
Print(_Symbol,
" | Bid = ", DoubleToString(bid, digits),
" | Ask = ", DoubleToString(ask, digits),
" | Last = ", DoubleToString(last, digits),
" | Spread = ", DoubleToString(spread_points, 1), " points",
" | Mid =", DoubleToString(mid, digits));
}
// ===
// =============================================================================================== //
// = Calculation of the strike price, taking into account the spread and slippage = //
// =============================================================================================== //
double ExecutionPrice(const string symbol, const bool is_buy, const double slippage_points)
{
MqlTick tick;
if(!SymbolInfoTick(symbol, tick))
return 0.0;
double point = SymbolInfoDouble(symbol, SYMBOL_POINT);
double slip = slippage_points * point; // margin for price slippage
// === for purchase we execute by Ask, for sale — by Bid ===
if(is_buy)
return tick.ask + slip;
return tick.bid - slip;
}
// ===
// =============================================================================================== //
// = Market activity by ticks: the more frequent the ticks, the more liquid the market is = //
// =============================================================================================== //
bool IsMarketActive(const string symbol, const int min_ticks)
{
MqlTick tick;
if(!SymbolInfoTick(symbol, tick))
return false;
// === comparing the number of accumulated ticks with the activity threshold ===
long tick_count = SymbolInfoInteger(symbol, SYMBOL_TICKS_BOOKDEPTH);
return (tick_count > 0) ?
true : (min_ticks <= 0);
}
How the example works. The OnStart() function requests the last tick via SymbolInfoTick() and extracts the Bid, Ask, and price of the last transaction from it, then converts the Ask−Bid difference into points and calculates the midpoint of the Mid price. The ExecutionPrice() function simulates the actual strike price: the purchase is based on Ask with a margin for slippage, the sale is based on Bid with the same margin, which makes the evaluation of the result closer to reality. The IsMarketActive() function serves as an illustration of the approach to activity assessment — a comparison with the threshold at which transactions make sense, because in a "dead" market the price is deceptive and costs are high.
An important limitation: the calculation is based on the current tick and the properties of the symbol, is updated on new data and does not take into account commissions, swaps and a possible sharp spread expansion. In a real Expert Advisor, you should additionally check the free margin, limit the maximum allowable spread and correctly handle slippage. When the rules of the strategy are formalized and the price is taken from the terminal according to a clear algorithm, the logical next step is to turn this into a full—fledged trading robot (Expert Advisor) on MQL5. An educational project MQL Master.
What gives an understanding of how the price is formed in practice:
It is from these principles that disciplined trading is formed. Understanding the mechanics of price is not the "secret of profit", but the foundation that removes basic mistakes and makes the strategy more honest in relation to real market conditions. For instruments where the price is based on liquidity flows, it is also useful to understand the nature of the instruments themselves, for example, in the material What is a CFD, which shows how the price of a CFD contract differs from the price of the underlying asset.
Understanding price formation does not eliminate market risk and does not guarantee results. The price can move against your position quickly and for no apparent reason, and costs can gradually "eat up" profits even from a formally correct strategy.
For trading systems and robots, this means the main thing: backtest results do not guarantee future results. Past tests do not take into account the actual conditions of execution, changes in liquidity and market conditions. Therefore, any strategy should be tested on a demo account, tested on real quotes, monitored for slippage, and only then carefully implemented on a small volume. No model or Expert Advisor provides guaranteed profits — risk is an integral part of the market.
This is the result of the coincidence of supply and demand at a particular moment. The price is shown by two values — the best purchase price (Bid) and the best sale price (Ask), and a deal is possible when the desires of the buyer and seller coincide.
Bid is the best price at which participants are willing to buy (for a trader— the selling price). Ask is the best price at which you are ready to sell (for a trader, the purchase price). The Ask is always higher than the Bid, and the difference is called the spread.
A quote is the best buy and sell prices displayed in a glass at the moment. The price of the last transaction is where the buyer and seller actually met. In a sluggish market, they may diverge because there are no deals, and orders change at the same time.
These are participants (banks, brokers, firms) who constantly hold purchase and sale orders in a glass and provide liquidity. They earn on the spread and turnover, taking on the risk of quoting both sides of the market.
The exchange has a single glass of orders and a single price for all participants, and the volumes are accurate. In the over-the-counter market, a broker aggregates the flow of quotes from several liquidity providers, so quotes from different brokers may vary slightly.
The candle is assembled from ticks for the selected interval: Open is the first price of the period, High and Low are the maximum and minimum, Close is the last price, and volume is the number of past ticks or trades. An older timeframe means a stronger "compression" of the movement.
Slippage is the difference between the expected and actual strike price. It appears when there is not enough liquidity at the required level: for example, on the news, the price passes by the order, and the order is executed worse.
It is impossible to accurately predict the price: it is formed by the actions of many participants with different information. It is worth working probabilistically — through scenarios, risk management and evaluation of the result on a long series of transactions, and not according to single forecasts.
The price of a financial instrument is not a property of the chart, but the result of the coincidence of supply and demand at a particular moment. Everything else grows out of this: buyers' and sellers' bids, two prices of the same instrument (Bid and Ask) and the spread between them, the difference between the quote and the price of the last transaction, the role of market makers and liquidity, the minimum price step and the tick as an atom of market information. On the stock exchange, the price is generated in a single glass of orders, and on the over—the-counter market - from the aggregation of the flow of quotes, so quotes from different brokers may differ slightly.
Follow the steps: understand that the price is a balance of supply and demand → understand the mechanics of bids and glasses → understand Bid, Ask and spread → see how ticks gather into candles → take into account costs and slippage → check any conclusions on a demo account in MetaTrader 5 → automate logic on MQL5 taking into account the real conditions of execution. Understanding how the price is formed does not guarantee profit or eliminate risk, but it removes the illusion of randomness and makes trading conscious. And when the rules become clear, the logical next step is to have your own trading robot built on an honest understanding of market mechanics.
Telegram community
Comments