Intraday trading is a mess if not done with a proper strategy. Most of the successful trading systems do not work in intraday timeframe due to numerous whipsaws and false signals. It’s imperative to minimize these whipsaws to build an accurate intraday trading system. We have been testing several day trading systems since last few months and would like to introduce one of the most successful and profitable systems. This system follows the principles of trend following and generates signals based on DEMA (Double exponential moving average). It’s a multi-timeframe strategy and to double confirm the signals it looks at RSI values from the daily timeframe.
Let’s look at the system details, backtesting results, and AFL code. A complete video explanation of this system is uploaded at our ‘Build a Professional Trading System Course‘
You may want to check out some of the other profitable intraday trading systems we have implemented in the past at our ‘AFL of the Week’ section.
DEMA RSI Intraday Trading System – AFL Overview
Parameter | Value |
Preferred Time-frame |
5 minutes |
Indicators Used | DEMA, RSI |
Buy Condition |
|
Short Condition |
|
Sell Condition | Same as Short or Time >= 15:15 |
Cover Condition | Same as Buy or Time >= 15:15 |
Stop Loss | 0.5% |
Targets | No defined target |
Position Size | 150 (fixed) |
Initial Equity | 200000 |
Brokerage | 100 per order |
Margin | 10% |
DEMA RSI Intraday Trading System – AFL Code
Download the AFL code from the below link. You can simply import this AFL code in Amibroker and start using it.
AFL Screenshot
Below is the screenshot of the AFL chart from Amibroker
Also Read: Manish Gupta: A 19 year old Algorithmic Trading Millionaire
DEMA RSI Intraday Trading System- Backtest Report
This is a very accurate intraday trading system and performs well in all market conditions. Annual CAGR of 21.49% is better than most of the other systems out there. Also, drawdown is minimum which makes this system very reliable. Check the detailed results in the below table:
Parameter | Value |
Nifty | |
Initial Capital | 200000 |
Final Capital | 1188711.75 |
Scrip Name | NSE Nifty |
Backtest Period | 01-Jan-2010 to 28-Feb-2019 |
Timeframe | 5 Minutes |
Net Profit % | 494.36% |
Annual Return % | 21.49% |
Number of Trades | 1438 |
Winning Trade % | 49.86% |
Average holding Period | 57.57 periods |
Max consecutive losses | 7 |
Max system % drawdown | -17.33% |
Max Trade % drawdown | -21.88% |
Download the detailed backtest report here.
In this system we have assumed a fixed position size of 150. Had it been it was allowed to invest all your profits back into the system, an investment of 200000 would have turned into whooping 25 Billion~ with CAGR of 181%.
Equity Curve
The equity curve is near linear with no unexpected and large drawdowns
Profit Table
This system has been consistently profitable every single year since 2010.
If you wanna learn and build your own Algorithmic trading systems like this, take a look at our structured courses at Trading Tuitions Academy
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:
Disclaimer:
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 support@tradingtuitions.com
HI, i am a regular visitors for your site and also subscribed for your amibroker course. Could you please write an article, how you are doing algorithm trading ? Suppose you have a strategy, how are you going to deploy automate it ? are you using any bridge application to connect to your broker ? if so, please provide us the details.
thanks f or your help.
Regards,
Hi Naga,
Sure, we will publish an article for the same. But just to summarize, we are using Symphony presto for automating the strategies. Read more about it here
The system performance betwee 2016 and 2018 is stalled. I mean not that steep compared to previous years. I have backtested more strategues all show the same phenomenon, stalled performance between 2016 and 2018
Hi Qtrader,
That’s because of heavy volatility during this period. But the important thing is that the returns remained positive. We are hoping for better performance in 2019
I think that’s something do with the HFT/algo trading era.
Hi, Does this strategy work better with certain stocks (with high/low volatility for eg., or a particular sector) or is neutral? Would you recommend this to be used with index options?
Hi Saurabh,
We haven’t tested it for options, but you can definitely use this on high beta stocks
Dear admin
thx for sharing the afl
backtest results as well as charts show only shorts and cover
does not display buy /sell both in charts as well as analysis
can you check just once …i am not sure whether i am doing something wrong
kindly do check if possible
Dear Admin
tried back testing it back tests only shorts
i m using amibroker 6.07 version
do i need to change any settings
thx in advance
Hi Sadayappan,
In the backtested settings, please mentions “Long and Short both”
Stratergy how to trade in bullion’s a d crude oil.
Is it 14 period RSI on daily timeframe? Specify that please
Hi Ashu,
Its on Intraday timeframe.
Hi,
Is there any Amibroker AFL to determine the sideways in intraday market?
Regards
hi
when i tested this code today i dont see any buy or sell signal coming up on the chart. Looking at the code, it does not any specific settings i suppose. can you please help?
Dear team,
Rsi period is default 14?
can I use 2 or 10 rsi?
Thanks,
Yoga
Yes you can, but returns may differ
wrong code
replace this
BuyPrice=Close;
SellPrice=Close;
ShortPrice=Close;
CoverPrice=Close;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
results are in loss
Hi Hardik,
Since the trade delay is set to 1, the strategy buys at OPEN price and not CLOSE. So there is nothing wrong with the code
sir while backtesting how to fix position size … my backtesting result increase and decreases the position value … but i want to test on fixed size … please let me know where to make changes for this .. i use amibroker trail version 6.0 ..
please help
You can try below code for fixed position size:
SetPositionSize( 100, spsShares );
Read documentation for more details: https://www.amibroker.com/guide/afl/setpositionsize.html
can tell me buy condition : which timeframe should i have to check for rsi 14 period i.e, daily or intraday? after 2 dema crossing 10 dema,…. i am using 15min timeframe for dema crossover.
Thanks in advance.
Hi Ajay,
You should check RSI on daily timeframe
Hello
I was trying to do this using NIFTY future historical intraday data from truedata from 2012 but the return was really poor compared to what it has been posted here. I am no expert in amibroker or backtesting. Wondering can it be different when backtesting was done on spot and future? Can you please explain.
Hi Rajib,
Yes, results can be different with futures prices. We always recommend to backtest on spot prices as the principles of technical analysis works the best on it.
Dear Admin,
Thank you for posting such wonderful amibroker codes. Really appreciate.
I am new to trading so please let me know if my thoughts are in right direction. The results are very poor when we backtest with NIFTY F1 data instead of NIFTY. But since, only NIFTY F1 is tradable, how do we trade using these algos in real life? This is for not just DEMA-rsi but other algos as well. Please guide.
Hi,
Generally, futures instruments are not meant to be bakctested. The idea is to backtest on underlying and trade on futures, you may use spot-future parity to find the respective prices