This is a breakout strategy where buy/sell signal is generated when price crosses a dynamic support/resistance. The calculation of support/resistance is based on highest high value and lowest low value for a particular lookback period. This strategy seems to work well in Trending markets.
Please visit Trading Tuitions Academy to learn AFL coding and create your own Trading systems.
|Preferred Timeframe||Daily, Hourly|
|Buy Condition||Price crosses above dynamic resistance.|
|Sell Condition||Price crosses below dynamic support.|
|Targets||No fixed target, Stop and reverse when AFL gives opposite signal|
|Position Size||150 (fixed)|
|Brokerage||50 per order|
Click here to download AFL code for this system.
|Backtest Period||01-Jan-2007 to 19-02-2016|
|Net Profit %||537.81%|
|Annual Return %||22.48%|
|Number of Trades||243|
|Winning Trade %||41.56%|
|Average holding Period||8.93 periods|
|Max consecutive losses||6|
|Max system % drawdown||-28.78%|
|Max Trade % drawdown||-60.73%|
Download the detailed backtest report here.
Please note that you can expect even better results if you allow compounding of your returns.
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