Here’s a quote from Isaac Newton – “What we know is a drop, what we don’t know is an ocean.”
A lot of you might know how to write strategies, but for all of you who don’t and think it is rocket science, Z-Connect will simplify it for you. But as mentioned in the intro blog, I am assuming that you understand at least basic Technical Analysis, if you don’t, I guess this topic would be premature for you.
The strategy is to trade using a 14-candle Exponential Moving Average. The idea is to buy/sell when the price crosses over the moving average on either side. This is something really basic, just to give you an idea on how the tool would work.
Step 1: Launch ZT (Zerodha Trader)
Step 2: Add the scrip that you’d like to trade on the market watch. In our case it’s Nifty Futures.
Step 3. Right click on the market watch and invoke the chart. Shortcut key : Shift + P, if you need help invoking the chart click here. Check out the pic below:
Step 4: Adjust the chart to your preference (double click on the blue panel at the extreme left of the chart and resize it), if you need help click here.
Our strategy is based on EMA (Exponential Moving Average); select EMA from the drop-down menu on the left and double click on it. See the pic below:
Step 5: Here’s how the chart with the indicator is gonna look like. See the pic below:
Step 6: A smart trader would not bet based on just 5 hours’ data, he will backtest it first. He will analyze if this strategy had made money over the last year and only if convinced would he start trading on this strategy. How do you backtest? Can you manually sit down and look at the intraday chart for the last one year and see how many times the strategy made profits/losses? It is a waste of time and this is where “algoZ” our new product on Zerodha Trader would come into play. On algoZ, you would write a small program instead of looking at the chart and then run a backtest.
The first step would be to write a strategy, so right click inside the chart, click on My Strategy and click Add New Script as shown below:
Step 7: Writing the strategy
You get an expression box like the one below where you can write your strategy using the four boxes: Buy, Buy Exit, Sell and Sell Exit. If you don’t want to write an expression for something, write 0 (zero). Don’t keep it blank. In this blog, the idea is to give you an overview, so don’t really worry too much on what the code is for your favorite strategy. See the pic below:
Step 8: Backtesting the strategy. Now that you have written the strategy you would want to know if this would have made profits in the past if applied. To backtest follow the steps in the pic below:
When clicked, the backtest details window opens up.
Presently, in the beta version, to backtest you will have intraday data for 22 days and daily data for over 1 year.
In the next version we will have:
1 minute data for 1 month, 5 minute data for 5 months and 10 minute data for 10 months. The next version will be launched as soon as the development process is complete. Note that backtesting might slow down the performance of ZT during peak trading hours, so it’s advisable to backtest before markets open or after trading hours.
Step 9: Going Live. Assuming you did want to take your strategy live, click on the Live option instead of the backtest option.
By going live, what I mean is that every time a buy or a sell trade is initiated based on your strategy, you get an alert to take the trade. If you decide to act on this, you can have a preset order which will be placed by just the click of a button (semi-automated trading). If you have access to a Zerodha dealer terminal, this process can be completely automated. What this would mean is that every time a buy/sell trade is initiated based on your strategy, trades are automatically executed with your preset quantity and stop loss.
See below to check out how it would work in case of semi-automated trading.
a. Putting up a preset order:
b. A Live strategy:
*presently you can take your strategy live only for Equity, F&O and Currency segments. MCX should be available in the next release.
In the above pic, if you had access to a dealer terminal you could make it such a way that you would not even get that script alert window to “act on alert”, orders would be placed automatically with the stop loss. A dealer terminal is given only to Authorized Persons/Sub-brokers as per exchange regulations and would require the person to comply in terms of NISM certifications and other exchange mandates. Once an individual has the NISM certification, Zerodha would initiate the process of making the client an Authorized Person at a nominal cost so he can execute his own trades automatically.
Like the way we have a script for EMA, we can have multiple such scripts running at the same time on multiple trading symbols.
As you would have probably realized by now, the odds of winning go up considerably by following the above process. This will let you know if a strategy is profitable or not before taking a trade, and if profitable, it’ll give you a fair idea of how much money you can risk trading such a strategy.
The tricky bit would be to write your own strategy but don’t worry about it, we will help you with writing strategies if you post them on the blog.
Time to start trading smarter!!!