Chapter 8
EMA + MACD --- Rohan's First System
On the first Sunday of December, at 6:12am, Rohan sat at his desk in Malad with his laptop open and a cup of chai that had gone cold beside him.
He had been awake since 5:30am. Not because of anxiety, for once, but because of something closer to readiness. He had been building toward this for six weeks. He had learned to read price. He had learned support and resistance. He had learned candlestick signals. He had learned volume. He had learned trends. He had learned to filter everything by moving averages.
He had all the pieces. What he had not yet done was put them together into a rule that he could follow every time, without exception, without improvising based on a feeling he could not name.
That morning, before KM Sir's weekly session, he was going to build his system.
The system had to answer three questions before any trade.
The first question: What is the trend? He had learned this in Chapter 6. The answer came from the 50 EMA. If price was above the 50 EMA and the 50 EMA was sloping upward, the trend was up. If price was below the 50 EMA and the 50 EMA was sloping downward, the trend was down. If neither condition was clear, the market was ranging and he would not trade.
The second question: Is there a signal in the direction of the trend? He had been wrestling with this for a week. He needed a way to identify when a trade opportunity had appeared in the direction of the trend. He had tried candlestick signals alone and found them inconsistent in real time. He needed something more systematic.
He had been reading about the MACD for the previous four days.
The MACD --- Moving Average Convergence Divergence --- was invented in the 1970s by Gerald Appel and had been one of the most widely used momentum indicators since. It calculated the difference between a twelve-period EMA and a twenty-six-period EMA, producing a line that moved above and below zero. A second line --- the signal line --- was a nine-period EMA of the MACD line itself. The histogram showed the difference between the two lines.
The crossover that mattered was this: when the MACD line crossed above the signal line, it indicated that short-term momentum was increasing relative to medium-term momentum. When it crossed below, the reverse. In a trending market, a MACD crossover in the direction of the trend was a signal that the trend was continuing with renewed momentum.
This was the signal he needed.
He wrote his system on a page in his notebook:
Rule 1: The 50 EMA must confirm the trend. Price above 50 EMA, 50 EMA sloping up = uptrend. Trade long only. Price below 50 EMA, 50 EMA sloping down = downtrend. Trade short only. Neither = no trade.
Rule 2: The MACD must cross in the direction of the trend. Long trade: MACD line crosses above signal line. Short trade: MACD line crosses below signal line.
Rule 3: Volume on the signal candle must be above the 20-period average. Low volume signals are not traded.
Stop loss: below the most recent swing low for long trades. Above the most recent swing high for short trades.
No exceptions.
He underlined "No exceptions" twice.
He sat back and looked at what he had written. It was three rules. It was not complicated. It did not require him to guess. It required him to observe three things and act when all three agreed.
He brought it to KM Sir at 9am.
KM Sir read it. He picked up his notebook, read yesterday's line, and closed it.
*A system you trust is worth more than a setup you are excited about.*
He read Rohan's three rules again.
"One thing is missing," he said.
"The target," Rohan said. He had known this.
"Yes. What is your exit?"
They spent twenty minutes on exits. The rule they agreed on was this: the target would be set at a minimum of twice the distance from entry to stop. A trade risking twenty rupees would target at least forty. This was the 1:2 risk-reward ratio --- the minimum at which the mathematics of trading worked in a trader's favour even if they won fewer than half their trades.
Rohan added it to his notebook as Rule 4: Target minimum 2x the distance from entry to stop.
KM Sir looked at the four rules. He said: "Now backtest it. Before you trade it live, look at the last three months of any chart you would trade and count how many times these four conditions occurred. Count how many of those resulted in a profitable trade if you had followed all four rules. Count how many resulted in losses."
"How do I know if the system is good?"
"You look at the results. If the system produced profitable trades more than fifty percent of the time at 1:2 risk-reward, the mathematics work in your favour with consistent application. Below fifty percent, you need to examine whether the market conditions during your test period were unusual, or whether the system has a fundamental problem."
Rohan spent the following week going through three months of Nifty 50 daily charts and identifying every instance in which his four rules aligned.
He found fourteen instances. Nine had been profitable at 1:2 risk-reward. Five had been losses. Win rate: sixty-four percent. His potential P&L for the period, trading one standard lot, would have been significantly positive.
The first live trade using the system came eleven days later.
All four conditions aligned on the daily chart of a large-cap banking stock in the Nifty Bank index. He checked the rules in order. 50 EMA: uptrend confirmed. MACD: crossed above signal line on the previous day. Volume: above average. He set his entry at the market open, his stop below the previous swing low, and his target at twice the stop distance.
He entered at ₹1,640. Stop: ₹1,594. Target: ₹1,732.
Three days later the stock touched ₹1,735 and he closed the trade.
Profit: ₹2,850.
The trade worked and he felt nothing except the thought that he wanted to check if he had followed all four rules correctly.
He checked. He had. Every rule had been followed. The trade had been taken exactly as the system required.
He did not know yet whether this meant the system was good. One trade proved nothing. He had been told this. But the feeling was different from any previous trade he had won. The previous profitable trades had felt like good luck. This one felt like the execution of a plan.
Three weeks after building the system, the Nifty 50 entered a sideways phase.
For eleven consecutive trading days, the index moved between ₹19,600 and ₹20,100 without clear direction. The 50 EMA flattened. The MACD crossed above and below the signal line three times in nine days. Each time it crossed, Rohan checked his Rule 1: Was the 50 EMA confirming a clear trend?
It was not. The 50 EMA was flat. The market was ranging.
Rule 1 said: ranging market, no trade. He did not trade for eleven days.
On the twelfth day, the market broke higher on above-average volume. The 50 EMA began to slope upward again. The MACD crossed above the signal line. Volume confirmed it. All four rules aligned.
He entered.
The trade was a loss. The breakout failed. He was stopped out at a loss of ₹2,100.
He looked at the trade afterward. He had followed all four rules. The trade had failed anyway.
He had known, intellectually, that this would happen. Systems did not win every trade. A sixty-four percent win rate from his backtest meant thirty-six percent of trades were losses. He had known this number. He had not experienced it yet.
He wrote in his notebook: The system worked. The trade lost. These are not contradictions.
This was the most important sentence he would write in the entire six months of Book 1. He did not know it yet. He would know it fully only after Chapter 9.
The backtesting process was slower and more manual than he had expected.
He had assumed backtesting meant running a program. It did not --- not yet. He did not have the programming skills to automate a backtest of a discretionary system, and more importantly, he had learned enough to be suspicious of automated backtests that he did not fully understand. The first backtest, KM Sir had told him, should always be manual: go through the chart bar by bar, apply the rules as if you are seeing each candle for the first time, and record what the rules would have produced.
He set aside the entire Saturday afternoon.
He opened a printed copy of the Nifty 50 daily chart for the previous ninety trading days. He covered everything after day one with a piece of paper and moved it forward one day at a time, asking the four questions at each candle as it appeared.
Rule 1: Is the 50 EMA confirming a clear trend? He drew the 50 EMA on his printed chart in pencil. For the first twenty days, the EMA was still sloping upward, which meant any signal in those days was a long signal. For the next thirty days, the EMA flattened and then began to slope downward, which meant the valid signals changed.
Rule 2: Has the MACD crossed in the direction of the trend? He marked every MACD crossover on the chart in red (bearish) and blue (bullish). In the trending phases, there were crossovers he could use. In the flat phase, there were crossovers that would have been false --- the EMA filter would have screened them out.
Rule 3: Is volume above the twenty-period average on the signal candle? He calculated the twenty-period average volume for each candle and marked each crossover as valid or invalid based on volume.
The process took three hours.
He found fourteen valid setups. Not thirty. Not fifty. Fourteen instances in ninety trading days where all four conditions aligned. This was roughly one setup every six days.
Of the fourteen setups, he traced what would have happened if he had entered on the open of the following candle with a stop below the recent swing low and a target at twice the stop distance.
Nine had reached the target. Five had hit the stop.
He calculated the net P&L. Using hypothetical position sizes of fifty shares at an entry price of approximately ₹19,000, each winning trade had produced approximately ₹4,800 (fifty shares × the target distance of approximately ₹96). Each losing trade had produced a loss of approximately ₹2,400 (fifty shares × the stop distance of approximately ₹48).
Net hypothetical P&L: nine wins × ₹4,800, minus five losses × ₹2,400. ₹43,200 minus ₹12,000. Net ₹31,200 on a hypothetical account.
He looked at this number. He had lost ₹40,247 in his first month. If he had been trading this system instead, for the previous ninety days, he would have been profitable.
He did not let himself feel too much about this. The backtest was not the same as live trading. The stops would not always execute at the exact price. The entries would not always be available at the expected level. His judgment on the EMA direction and the MACD validity would vary. He had been warned about all of this. But the mathematics of the system, even imperfectly applied, appeared to work.
The eleven days of the sideways market taught him something the backtest had not.
In a backtest, the sideways period was visible as a horizontal band on the chart. You could see it from above and you could see it ending. In real time, you could not. You knew the market had been sideways for eight days. You did not know if it would be sideways for two more days or twenty more.
The Rule 1 filter --- no trade unless the 50 EMA confirms a clear trend --- had been designed precisely for this situation. But applying it required judgment. The EMA was flattening. Was it flat enough to call the trend unclear? Was this a pause before the trend continued, or the beginning of a range?
He asked KM Sir.
"You will not always know the answer to that question," KM Sir said. "When you are uncertain whether the 50 EMA is trending or ranging, the default is to wait. The cost of waiting is missing a trade. The cost of entering a ranging market with a trend-following system is a series of false signals and a series of losses. The cost of waiting is lower."
"But in real time, it feels like missing an opportunity," Rohan said.
"Yes. That feeling does not change. You learn to value the system's protection more than the feeling of having missed something."
He waited out the sideways market. He was stopped out on the first trade after it ended. He did not violate the system. He filed the loss in his notebook as a system loss, which was different from an error loss. One he could live with. The other he could not.