Day trading can be tricky and unpredictable if you do not understand the basics behind it. You need to be armed with reliable indicators and patterns to be successssfuly at intraday trading. Stochastic is one such indicator which has been round for a long time. It is suitable for both intraday trading as well as swing trading. In this post, we would explore one of the Intraday Stochastic trading system which has given 63%~ annual compounded returns in last 3 years. Also, Amibroker AFL code for this system has been provided.
What is Stochastic Indicator and How it is calculated?
Stochastic is a momentum indicator which shows the strength of current trend. It does so by comparing current price to the range of prices within a definite lookback period. It is an oscillator and its value ranges from 0 to 100, hence it can also identify overbought and oversold price levels very accurately.
Stochastic Indicator was developed by George C Lane in 1950’s. According to an interview with Lane, the Stochastic Oscillator “doesn’t follow price, it doesn’t follow volume or anything like that. It follows the speed or the momentum of price. As a rule, the momentum changes direction before price.”
Stochastic Indicator is calulcated using below formula:
%K = (Current Close – Lowest Low)/(Highest High – Lowest Low) * 100
%D = 3-day SMA of %K
Lowest Low = lowest low for the look-back period
Highest High = highest high for the look-back period
The default look-back period is 14 days which can be changed depending on the security traded. Trading signals are generated when %K line of Stochastic crosses %D line.
Stochastic Divergances can also very accurately determine price reversals. Divergence occurs when the direction of the price trend and the direction of the indicator trend are moving in the opposite direction.
Read on to see a profitable trading system based on Stochastic:
Please visit Trading Tuitions Academy to learn AFL coding and create your own Trading systems.
Intraday Stochastic Trading System – AFL Overview
|Indicators Used||StochD, StochK|
|Position Size||100% of equity|
|Brokerage||100 per order|
Intraday Stochastic Trading System – AFL Code
Download the AFL code from this link. You’ll need to unzip it before importing into Amibroker.
Also Read: Ichimoku Trading System AFL Code
Intraday Stochastic Trading System – Backtest Report
|Scrip Name||NSE Nifty|
|Backtest Period||01-Jan-2014 to 20-Nov-2017|
|Net Profit %||571.44%|
|Annual Return %||62.64%|
|Number of Trades||265|
|Winning Trade %||56.60%|
|Average holding Period||31.57 periods|
|Max consecutive losses||5|
|Max system % drawdown||-22.90%|
|Max Trade % drawdown||-9.32%|
Download the detailed backtest report here.
This intraday trend following strategy has been profitable every year from 2014 to 2017
Additional Amibroker settings for backtesting
Goto Symbol–>Information, and specify the lot size and margin requirement. The below screenshot shows lot size of 75 and margin requirement of 10% for NSE Nifty:
All the AFL’s posted in this section are for learning purpose. Trading Tuitions does not necessarily own these AFL’s and we don’t have any intellectual property rights on them. We might copy useful AFL’s from public forums and post it in this section in a presentable format. The intent is not to copy anybody’s work but to share knowledge. If you find any misleading or non-reproducible content then please inform us at firstname.lastname@example.org