Menu
  • Crash Course on Orderflow
  • Training
  • Premium
  • Traders Cafe
  • Intraday signals
  • MCX Signals
  • Library

Marketcalls

Simply Intelligent Technical Analysis and Trading Strategies

  • Software
    • Amibroker
    • NinjaTrader 7
    • Ninjatrader 8
    • Option Action
    • Market Analyst
    • Metatrader
    • Python
    • Datafeed
  • Market Profile
    • Orderflow
  • Markets
  • Commodities
  • Forex
  • Economy
    • Banking
  • Webinars
  • Trading Lessons
    • Algo Trading
    • Infographic
    • Video
You are here: Home / Amibroker / Amibroker AFL Code to Compute 10 Year Rolling Returns

Amibroker AFL Code to Compute 10 Year Rolling Returns

December 16, 2016 by Rajandran 5 Comments

Here is the simple AFL code to compute the 10 year rolling returns for any script. Generally Rolling Returns are computed for 3yr, 5yr, 10yr period. Rolling Returns are basically a performance measure of fund/index/stock over a period of time. Above chart shows current 10 year rolling returns of Nifty at 7.47%.

Rolling Returns are nothing but computation of Historical CAGR. Formula for calculation of CAGR is shown below.

CAGR = [(Ending Price ÷ Beginning Price)^1/n] – 1

where CAGR – Compound Annual Growth Rate
where “n” is the number of time periods (10 years for this example)

Note : To Compute 10 Year Rolling Returns historical data of 10+ years adjusted to split/bonus is required in case of stocks.

Here is the AFL code to compute 10 Year Rolling Returns. Code is designed to adapt to multiple timeframes like Daily, Weekly, Monthly however it is recommended to use weekly/monthly for better accuracy.

Amibroker AFL Code – 10 Year Rolling Returns

Related Readings and Observations

  • Code Snippet : ORB – Open Range Breakout Levels – Amibroker AFL Code (Better Version)Code Snippet : ORB – Open Range Breakout Levels – Amibroker AFL Code (Better Version) Open Range Breakout is a simple strategy which monitors first 5min / 15min / 15min / 30min / 60min range from the start of the market. From the opening high range and low range is […]
  • PercentRank Based Smooth ATR to Predict Change in Volatility – Amibroker AFL CodePercentRank Based Smooth ATR to Predict Change in Volatility – Amibroker AFL Code Is there a way where one can identify market regime shift from low volatility zone to high volatility zone and vice versa? How I can identify stocks with increasing volatility? Is there a […]
  • How to Get Moneycontrol News Snippets into Amiboker?How to Get Moneycontrol News Snippets into Amiboker? Getting the newsfeed directly into my favorite charting software is always been interesting to me. If you are a news-hungry trader/investor possibly you may be also thinking in the same […]
  • Code Snippet : Price with Last Trade Price Marker : AmibrokerCode Snippet : Price with Last Trade Price Marker : Amibroker Here is a simple Amibroker AFL code snippet which tracks the last trade price with a dashed horizontal line at LTP. It could be useful for the people who wants to know where the current […]
  • Trading the Previous Day High and Previous Day Low Breakout – Do Simple Strategies Really Work? [Part1]Trading the Previous Day High and Previous Day Low Breakout – Do Simple Strategies Really Work? [Part1] Do simple strategies really work in Indian Markets? This curiosity arises when one of our Amibroker Mumbai Participant comes up with a simple trading strategy. Hence the tutorial series, […]
  • Absolute Monthly and Yearly   Profit/Loss Table – Amibroker AFL CodeAbsolute Monthly and Yearly Profit/Loss Table – Amibroker AFL Code while back-testing by default Amibroker provides Profit Table in Compounded percentage terms. However the profit table can be customized according to ones requirement. Rather than doing a […]

Filed Under: Amibroker Tagged With: 10 Year Rolling Returns, AFL Code, Amibroker

About Rajandran

Rajandran is a Full time trader and founder of Marketcalls & Co-Founder of Traderscafe, trades mostly using discretionary Trading Concepts like Market Profile, Trading sentimental analysis, building timing models, algorithmic trading models. Instructs professional traders, full time traders & aspiring full time traders. Rajandran attended college in the Chennai where he earned a BE in Electronics and Communications. Rajandran has a broad understanding of trading softwares like Amibroker, Ninjatrader, Esignal, Metastock, Motivewave, Market Analyst(Optuma),Metatrader,Tradingivew,Python and understands individual needs of traders and investors utilizing a wide range of methodologies.

Comments

  1. brijesh says

    December 16, 2016 at 11:24 am

    i added in ami formula but blank chart… why ?

    Reply
    • Rajandran says

      December 17, 2016 at 4:45 am

      Make sure you have 10 years+ historical data to get 10 Years rolling returns.

      Reply
  2. pradeep says

    December 18, 2016 at 5:52 pm

    i’m using amibroker 4.80 & have data sinse 2003.
    but getting error in Afl program writer ” Ln: 2, Col: 8 : error 30. Syntax error”

    Reply
    • Rajandran says

      December 19, 2016 at 9:05 am

      It is recommended to test with 5.5 version or above as some of the functions in the afl might not be compatible with older versions.

      Reply
  3. jayvant says

    February 17, 2019 (2 days ago) at 12:33 pm

    do you have an “exploration” version of the rolling average code?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Email Newsletter

Sign up to receive email updates on latest trading strategies , analysis & financial market updates

We Respect Your Privacy

Premium Access

Username:
Password:
Remember Me
Lost your password?

Tools For Traders

  • Marketcalls Android App
  • MCX Signals
  • Intraday Signals
  • International Commodities
  • OI Tracker
  • Participation OI
  • Your Broker
  • Market Sentiment Analysis

Amibroker Updates

[Recorded Webinar] How to Send Bracket Order, Cover Order and Multiple Orders using Amibroker and AlgoAction Platform

December 25, 2018 By Rajandran 1 Comment

AlgoAction Now Supports Bracket Order and Multi Orders

December 23, 2018 By Rajandran Leave a Comment

Code Snippet : ORB – Open Range Breakout Levels – Amibroker AFL Code (Better Version)

December 4, 2018 By Rajandran 1 Comment

Button Trading in Amibroker using AlgoAction Platform

December 2, 2018 By Rajandran Leave a Comment

[Recorded Webinar] Chart Based Vs Scan/Exploration Based Automated Trading – Amibroker

December 2, 2018 By Rajandran 1 Comment

  • Facebook
  • Google+
  • LinkedIn
  • RSS
  • Twitter
  • YouTube

Metatrader Updates

MetaTrader 5 Demo Servers Now Available for BSE Currency Markets

March 20, 2018 By Rajandran 8 Comments

ChartIQ – WebTrader for MT4

December 4, 2017 By Rajandran 4 Comments

Metatrader 4 – Web Platform Overview

October 29, 2015 By Rajandran 9 Comments

William VIX FIX Indicator for Metatrader 4

May 16, 2015 By Rajandran 9 Comments

How to Install Custom MQL4 indicators in Metatrader

November 14, 2014 By Rajandran 6 Comments


About | Contact Us | Terms and Conditions | Privacy Policy | Support Policy | Privacy Policy | Refund Policy | Disclaimer


© Copyright 2018 Marketcalls Financial Services Pvt Ltd · All Rights Reserved · And Our Sitemap · All Logos & Trademark Belongs To Their Respective Owners·

Data and information is provided for informational purposes only, and is not intended for trading purposes. Neither marketcalls.in website nor any of its promoters shall be liable for any errors or delays in the content, or for any actions taken in reliance thereon.