Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Autocorrelation and Stochastic Mean Reversion Trading

44 sec read

Here is a simple mean reversion trading system using Autocorrelation and Stochastic osciallator crossover. In the last article we seen about autocorrelation that negative correlation attracts mean reversion trading and positive correlation attracts trend trading. so the whole idea of the trading system is not to take all the stochastic crossover signals. But only the long only positive crossover signals when the autocorrelation is negative.

Nifty Autocorrelation Mean Reversion Strategy

[wp_ad_camp_5]

 
Trading Strategy Rules
1)Enter Long trade at the next day open only if the auto-correlation is negative and there is a positive stochastic crossover.
2)Exit Long trade at the next day open if either the auto-correlation turns positive or if there is a negative stochastic crossover

Autorcorrrelation and Stochastic Mean Reversion Trading – Amibroker AFL coding
https://gist.github.com/marketcalls/3ac1f596152061edf7d0

Strategy tested with Nifty Futures Daily timeframe with 100 shares (4 lots x25 shares of Nifty) for Long only trades. Commission+Taxes+Slippages are assumed to be Rs150 per trade. Tested with historical data right from the year 2005. And the holding time of the trading strategy range from 2 days to 10 days max.

Equity Curve
1_ Portfolio Equity

Check out the complete backtest report since 2005 for Nifty futures

Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

CUSUM Filter Strategy in AmiBroker AFL: A Practical Implementation

Detecting meaningful shifts in price trends while filtering out market noise is a challenge many traders face. Inspired by Jakub Polec’s blog, which applies...
Rajandran R
2 min read

Fisher Transform – Amibroker AFL Code

The Fisher Transform is a technical analysis indicator developed by John F. Ehlers, designed to identify potential turning points in the price movements of...
Rajandran R
2 min read

My Experience Converting SSL Hybrid from PineScript to Amibroker…

As a trader and coding enthusiast, I often find myself needing to translate trading indicators from one programming language to another. Recently, I embarked...
Rajandran R
8 min read

16 Replies to “Autocorrelation and Stochastic Mean Reversion Trading”

  1. Hello Rajandran,

    Thanks for the blog post. :).. One point i wanted to run by you:

    I see that you like to dissect the trading set up and optimize each entity.

    Example:

    The current blog spot i.e. Autocorrelation and Stochastic Mean Reversion Trading or ATR Long only System.

    You have optimized them to catch the specific aspect, in this case going long only and though we can take signals for shorting, you advise not to because we are increasing the risk factor for fraction of the profit generated by the long.

    Kindly clarify my doubt, say in a month like December when there was a down trend in Nifty, even though we have a specific system to catch longs, but the market was not conductive and there is not a possibility of of not taking trades or possible whipsaws.

    It would be really beneficial if you can give us a system that specializes in short only, for higher time frames for volatile scrips like BN etc…

    I don’t mean to impose and want to emphasize that i am grateful and confident that so are many more who have benefited from your out of the box thinking.

    Thanks

    Sai

    1. Hi Sai,

      To be frank i havent searched for a pure short only system yet. And one thing i want to point you here. Iam not optimizing each and every entity here. If i do so mostly probably we will end up with curve fitting. My optimization variable will be around 2-3 parameters max at any given trading system. More the Optimization variable more it does only curve fitting.

      Anyways thanks for your ping to look out for pure Short only strategies. Will explore!

    1. Yes the system is designed accordingly since it is a EOD based strategy. You can either choose the days closing or at the next day open for your entry or exit. You can set the trade delay in the AFL code to 0,0,0,0 if you want to enter on the same day close to the market close.

    1. No broker in India will offer MT4 because MT4 is not made for stock exchanges so none of the stock exchange in the world will approve such trading terminals for trading. MT4 is built for Forex and CFD’s.

      1. few international brokers used to provide indian indices and stocks in their mt4 demo accounts in the past ( e.g. fxcentral & oanda etc. ), although may not be much legal, but it was very handy for analysis purpose, but now…… 🙁

        any way thnx 4 ur reply.

  2. Profit Loss % is just less than 1. Only 53 % profits.We have to trade with caution.

  3. Hi Rajandran,

    Attachment is not available in this post. Please let me know where I can see that.

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More