MCX gold futures backtesting, long and short
Backtest GOLD and GOLD MINI futures on one-minute data with your own indicator rules. Veloce goes long or short, reverses in a single order, keeps new lots within a margin limit, and charges every fill with the commodity schedule, CTT on sells included.
Two contracts, one quote
GOLD
1 kg a lot
- Units of 10 g a lot
- 100
- Tick
- ₹1 per 10 g
- One tick on a lot
- ₹100
- A ₹500 move on a lot
- ₹50,000
GOLD MINI (GOLDM)
100 g a lot
- Units of 10 g a lot
- 10
- Tick
- ₹1 per 10 g
- One tick on a lot
- ₹10
- A ₹500 move on a lot
- ₹5,000
The ₹500 move is illustrative. Lot units and the tick are the values Veloce uses; check MCX’s contract specifications for delivery, tender period and price limits, which the backtest does not model.
Which contract a backtest trades
Veloce reads the gold futures listed on MCX from Dhan’s public scrip master, cached once a day, and picks the first one that expires after your backtest’s end date. The whole run trades that contract, so there is no roll and no stitched price series to distort entries.
The limit is history. Dhan keeps intraday bars only for contracts still trading, so a backtest can cover the months a currently listed contract has traded, and an end date beyond every listed expiry is refused with a message saying so.
- 1
You choose the period
For example, 26 to 29 October 2026.
- 2
Veloce lists the gold futures
From the scrip master, with their expiries.
- 3
It picks the first expiry after the end
One contract, kept for the whole run.
- 4
It replays that contract’s one-minute bars
Resampled from 09:00 to the candle size you set.
A session that runs into the night
From 09:00
Commodity candles start at 09:00 IST, and the futures strategy may enter from the first closed candle.
Into the evening
Entries are allowed until 23:00 and open positions are squared off at 23:15 by default, before the session closes.
Your own window
First entry, last entry and square-off are settings. Clear the square-off to hold positions overnight.
MCX ends the evening session at different times depending on whether the United States is on daylight saving time. The default 23:15 square-off falls before both.
Long and short on your own rules
- When every bullish condition holds on a closed candle, it goes long the lots you set.
- When every bearish condition holds, it goes short.
- When the signal flips, it reverses in one order: from one lot long to one lot short is a single sell of two lots.
- Stops, targets and trailing stops can be set in rupees or as a share of the contract value.
{
"name": "futures-trader",
"description": "trade MCX gold futures long and short on your own rules",
"entry": {
"signal": {
"kind": "rules",
"indicators": [
{
"name": "fast",
"kind": "ema",
"period": 9
},
{
"name": "slow",
"kind": "ema",
"period": 21
}
],
"bullish": [
{
"left": "fast",
"comparison": "crosses_above",
"right": "slow"
}
],
"bearish": [
{
"left": "fast",
"comparison": "crosses_below",
"right": "slow"
}
]
},
"first_entry": "09:00",
"last_entry": "23:00"
},
"legs": [
{
"kind": "underlying",
"side": "buy"
}
],
"bearish_legs": [
{
"kind": "underlying",
"side": "sell"
}
],
"square_off": "23:15",
"risk": {
"rules": [
{
"kind": "futures_margin"
}
]
},
"costs": {
"charges": [
{
"kind": "mcx_futures"
}
]
}
}The shipped futures strategy as a strategy spec: EMA 9 crossing EMA 21, long and short legs on the underlying future, futures margin and the MCX charge schedule.
Commodity charges on every fill
| Charge | Rule | Applies to |
|---|---|---|
| Brokerage | ₹20 per order | Every order |
| Exchange transaction charge | 0.0021% of turnover | Buys and sells |
| SEBI turnover fee | 0.0001% of turnover (₹10 a crore) | Buys and sells |
| Commodity transaction tax (CTT) | 0.01% of turnover | Sells only |
| Stamp duty | 0.002% of turnover | Buys only |
| GST | 18% of brokerage, exchange and SEBI charges | Every order |
One GOLDM lot bought at ₹1,21,451 and sold at ₹1,21,979 per 10 g pays about₹256.66 in charges across both fills. Illustrative prices, with one tick of slippage on each fill.
Buy GOLDM future
1 lot of 10, filled at the next open
- Next candle’s open
- ₹1,21,450.00
- One tick of slippage
- +₹1.00
- Fill price
- ₹1,21,451.00
| Brokerage | ₹20.00 |
|---|---|
| Exchange charge | ₹25.50 |
| SEBI fee | ₹1.21 |
| CTT | ₹0.00 |
| Stamp duty | ₹24.29 |
| GST | ₹8.41 |
| Charges on this fill | ₹79.42 |
Sell GOLDM future
1 lot of 10, filled at the next open
- Next candle’s open
- ₹1,21,980.00
- One tick of slippage
- −₹1.00
- Fill price
- ₹1,21,979.00
| Brokerage | ₹20.00 |
|---|---|
| Exchange charge | ₹25.62 |
| SEBI fee | ₹1.22 |
| CTT | ₹121.98 |
| Stamp duty | ₹0.00 |
| GST | ₹8.43 |
| Charges on this fill | ₹177.24 |
Gold futures questions
- What is the difference between MCX GOLD and GOLD MINI?
- Both are quoted in rupees per 10 grams. GOLD is a 1 kg contract, so a ₹1 move in the quote is ₹100 a lot; GOLD MINI (GOLDM) is 100 grams, so the same move is ₹10 a lot. Veloce backtests both, with GOLDM as the default.
- Which gold futures contract does a Veloce backtest trade?
- The first listed contract that expires after the backtest’s end date, read from Dhan’s public scrip master. The whole run trades that one contract, so it never rolls over.
- How far back can I backtest MCX gold futures?
- Dhan keeps intraday history only for contracts still trading, so a backtest can cover the life of a currently listed contract, not earlier ones that have expired.
- How is margin modelled for gold futures?
- As a share of each lot’s value that you set, 10% by default. New lots are cut so that the margin of every open future fits within equity. It is a simple rate, not the exchange’s SPAN margin.
- Can I short gold futures in a backtest?
- Yes. The futures strategy goes long on its bullish conditions and short on its bearish ones, and reverses in one order when the signal flips.
Backtest a gold futures strategy
Create an account with a verified email and phone number, pick a strategy and a market, and see every fill, fee and day of P&L.