Buy when short-term resistance is broken and stock is in uptrend
Step 2: Selecting Indicators for Support Resistance Using Averages AFL
In most simple terms, support is defined at the price level from which market bounces up while resistance is the price level from which market goes down.
When prices bounce from the 20-period MA, we take that point as support level. When prices fall after touching 20-period MA, we that that price as resistance level. This is because most people use Moving Average Crossover for analysis/trading.
When the market is trending, we buy on the break of resistance. But when the market is sideways, we do not enter a trade at all. Plus Directional Index (PDI) and Minus Directional Index (MDI) indicators are used to determine whether or not the market is trending.
Step 3: Defining Clear Strategy Rules for Support Resistance Using Averages AFL
Buy: When prices go above short-term resistance and PDI is above 30.
Sell: When prices go below short-term support.
Step 4: AFL Coding Guide
In AFL coding, we simple record the value of MA crossover using ValueWhen() function. We carefully define the Buy, Sell, Short and Cover rules; where Short and Cover are symmetrically opposite if Buy and Sell. This helps in smooth integration of this AFL with automated trading systems
Step 5: The Backtest
The strategy is significantly profitable in Bank Nifty current month futures. It generates a profit of 5649 points, or Rs. 4,23,675/ over two years on one lot (75 shares). The winner% is 41.13, which is decent for automated support and resistance strategy.
Related Article: Basics in Strategy Backtesting
- Scrip: Bank Nifty current month futures, 15-minute
- All trades executed at Close price of the bar on which signal is triggered
- Brokerage: 0.01% of Trade Value
- Data History: 01-01-2014 to 31-12-2015 (two years)
- Strategy Optimization: None
Step 6: Further Improvement
We leave it to the readers to suggest any improvement in Step 2 and Step 3 which can increase the profitability. We can introduce custom stoploss as well as profit targets to further maximize the profitability.
Download here Support Resistance Using Averages AFL
Click here to download the editable Amibroker Support Resistance AFL Strategy
Click here to learn Support and Resistance from Chart School.