SlideShare a Scribd company logo
Amibroker AFL Coding
Rajandran R
www.marketcalls.in
Disclaimer
▪ TRADING FUTURES AND OPTIONS INVOLVES SUBSTANTIAL AMOUNT OF
RISK OF LOSS AND IS NOT SUITABLE FOR ALL INVESTORS
▪ PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE
RESULTS.
▪ AMIBROKER IS REGISTEREDTRADEMARK OF AMIBROKER.COM.
▪ WE ARE NEITHER ASSOCIATED WITHTHE ABOVETRADEMARK OWNERS
NOR DOWE REPRESENT THEM IN ANY MANNER. WE ARE NOT OFFERING
AMIBROKER PLATFORM FOR SALE ON OURWEBSITE / IN OUR OFFICE.
www.marketcalls.in Customer Support : 09738383344
About Me
▪ Running a Financial Start-up
▪ Author of www.marketcalls.in since Sep 2007
▪ Trading System Designer
▪ SystemTrader & Financial Blogger
▪ More www.marketcalls.in/about
www.marketcalls.in Customer Support : 09738383344
No Subjective Interpretation
▪ NoTrend Lines
▪ No Gann
▪ No Fibonacci
▪ No Elliot wave
▪ NoTrading Patterns
▪ No Divergence
▪ No News
▪ No Fundamentals
www.marketcalls.in Customer Support : 09738383344
Trading Analysis Software
Amibroker Metastock Ninjatrader
Esignal Multicharts
www.marketcalls.in Customer Support : 09738383344
Free Data Providers for Amibroker
Google Finance
(EOD, Intraday)
Yahoo Finance
(EOD, Intraday,
Fundamental)
ASCII
(csv, txt)
MSN Money
(EOD)
Quandl
(EOD)
www.marketcalls.in Customer Support : 09738383344
Subscription based Data Providers
Globaldatafeeds Neotradeanalytics
Esignal
(Platform + Data
feed)
DTN IQFeed
Interactive Brokers
(Brokerage + Data
feed )
CQG
www.marketcalls.in Customer Support : 09738383344
Why Amibroker?
▪ Ease of Use
▪ High Speed Execution
▪ Supports Autotrading (Symphony Fintech, Interactive Brokers)
▪ CustomTimeframe
▪ MultiTimeframe Support
▪ Backtesting Optimization Walk ForwardTesting
▪ Scanning and Exploration
▪ Custom Indicators (AFL Programming)
www.marketcalls.in Customer Support : 09738383344
Amibroker Formula Language (AFL)
www.marketcalls.in Customer Support : 09738383344
▪ AFL is Vector Programming Language
▪ Write your own Custom Indicators, Scanners, Exploration and custom
commentaries
▪ Write your ownTrading System Rules
AFL Tokens
▪ Identifiers
▪ Constants
▪ String – literals
▪ Operators
▪ Punctuators (Separators)
www.marketcalls.in Customer Support : 09738383344
Built-in Identifiers
Identifiers Abbreviation
Open O
High H
Low L
Close C
Volume V
OpenInt OI
Avg
www.marketcalls.in Customer Support : 09738383344
Comparison Operators
Symbol Meaning
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
== Equal to
! Not
!= Not Equal to
www.marketcalls.in Customer Support : 09738383344
Arithmetic and Logical Operators
Symbol Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
^ Exponentiation
| & BitwiseOR BitwiseAND
www.marketcalls.in Customer Support : 09738383344
Symbol Meaning
NOT Logical NOT
AND LogicalAND
OR Logical OR
Sample Built-in Functions
▪ RSI(14) - 14 period RSI
▪ MACD() - Default MACD
▪ EMA(c,10) - 10 period EMA
▪ Ref(C, -1 ) - Previous Close Array
▪ MA(C,25) - 25 period Simple MA
▪ Cross(C, EMA(c10)) - Crossover Functions
▪ Barindex() - returns total number of bars (similar to Barcount)
More at http://www.amibroker.com/guide/a_funref.html
www.marketcalls.in Customer Support : 09738383344
Understanding Arrays
www.marketcalls.in Customer Support : 09738383344
AFL Arrays Example 1
www.marketcalls.in Customer Support : 09738383344
Day
1 2 3 4 5 6 7 8 9 10
1 Open 123 124 121 126 124 129 133 132 135 137
2 High 124 127 125 129 125 129 135 135 137 129
3 Low 120 121 119 120 121 124 130 128 131 127
4 Close 123 126 124 128 125 125 131 130 132 128
5 Volume 8310 3021 5325 2834 1432 5666 7847 555 6749 3456
6 Ref(C-1) NULL 123 126 124 128 125 125 131 130 132
Pattern Detection Functions
▪ Inside()
▪ Outside()
▪ GapUp()
▪ GapDown()
Gives a "1" or “True” when a
inside Pattern occurs.
Gives "0" or “False” otherwise.
www.marketcalls.in Customer Support : 09738383344
Plot Functions
▪ Plot()
▪ PlotOHLC()
▪ PlotShapes()
Demo
www.marketcalls.in Customer Support : 09738383344
Plot Arrows
/* Plot Buy and Sell SignalArrows */
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
www.marketcalls.in Customer Support : 09738383344
AFL Arrays Example 2
www.marketcalls.in Customer Support : 09738383344
Day
1 2 3 4 5 6 7 8 9 10
1 Open 123 124 121 126 124 129 133 132 135 137
2 BeginValue( Open ) 124 124 124 124 124 124 124 124 124 124
3 EndValue( Open ) 132 132 132 132 132 132 132 132 132 132
4 SelectedValue(Open ) 121 121 121 121 121 121 121 121 121 121
5 LastValue( Open ) 137 137 137 137 137 137 137 137 137 137
6 Close 122 126 123 128 125 125 131 130 132 128
Lowest/Highest Functions
▪ LLV()
▪ HHV()
▪ Lowest()
▪ Highest()
▪ LLV(C,10)
▪ HHV(c,10)
▪ Lowest( RSI(14))
▪ Highest( MFI(14) )
DEMO
www.marketcalls.in Customer Support : 09738383344
Alerts (in built and 3rd Party)
▪ SoundAlert
▪ Voice Alert
▪ Email Alert
▪ Alertif() , say() functions
▪ Twitter Alert [tweetymail]
▪ Trade Sender
▪ Push Bullet [http api]
www.marketcalls.in Customer Support : 09738383344
Param Control Functions
▪ Param()
▪ Paramcolor()
▪ Paramstr()
▪ ParamTime()
▪ ParamDate()
▪ ParamField()
▪ ParamTrigger()
▪ ParamList()
▪ ParamToggle()
▪ ParamStyle()
DEMO
www.marketcalls.in Customer Support : 09738383344
Built-in Trading Logic Identifiers
▪ Buy
▪ Sell
▪ Short
▪ Cover
DEMO
www.marketcalls.in Customer Support : 09738383344
Simple Exploration
www.marketcalls.in Customer Support : 09738383344
Filter =1;
AddColumn(RSI(10),"RSI", 1.2);
AddColumn(EMA(C,10),"EMA10",1.2);
AddColumn(v,"volume",1);
Understanding different IF Functions
▪ IF
▪ IIF
▪ WriteIF
▪ If(buy[barcount-1] == true)
▪ Color =
iif(RSI(14)>70,colorgreen,colorred)
www.marketcalls.in Customer Support : 09738383344
Multitimeframe Functions
SwitchingTimeframe
• TimeFrameSet
• TimeFrameRestore
Compress/Expand
• TimeFrameCompress
• TimeFrameExpand
Access DiffTimeframe
• TimeFrameGetPrice
www.marketcalls.in Customer Support : 09738383344
Multimeframe Getprice
TimeFrameGetPrice( "O", inWeekly, -1 ) // gives you previous week Open price
TimeFrameGetPrice( "C", inWeekly, -3 ) // gives you weekly Close price 3 weeks ago
TimeFrameGetPrice( "H", inWeekly, -2 ) // gives you weekly High price 2 weeks ago
TimeFrameGetPrice( "O", inWeekly, 0 ) // gives you this week Open price.
TimeFrameGetPrice( "H", inDaily, -1 ) // gives previous Day High when working on intraday data
www.marketcalls.in Customer Support : 09738383344
Components of Trading System
Initial
Parameters
Trading
Logic
Position
Size
Signals &
Alerts
Dashboard
www.marketcalls.in Customer Support : 09738383344
Simple Trading System
SetTradeDelays(1,1,1,1);
SetPositionSize(100,spsShares);
par1 = param("par1",10,1,50,1);
par2 = param("par2",15,1,50,1);
sema = EMA(C,par1);
lema = EMA(C,par2);
Buy = Cross(sema,lema);
Sell = Cross(lema,sema);
www.marketcalls.in Customer Support : 09738383344
Position Size & Trade Delay
▪ SetTradeDelays(1,1,1,1); //Trade Delay of 1 Bar
▪ SetPositionSize( 100, spsShares ); // 100 shares by default
▪ SetPositionSize( 10, spsPercentofEquity ); //Percentage Equity
▪ SetPositionSize( 100000, spsValue ); // Fixed Amount
http://www.amibroker.com/kb/2014/10/12/position-sizing-based-on-
risk/
www.marketcalls.in Customer Support : 09738383344
Equity Curve
www.marketcalls.in Customer Support : 09738383344
Backtesting
www.marketcalls.in Customer Support : 09738383344
Trading System Design Cycle
Analysis
Design
ImplementTesting
Evaluate
www.marketcalls.in Customer Support : 09738383344
Time Based Trading Rules
▪ Timenum() Function
▪ Mostly Rules for Intraday
DEMO
www.marketcalls.in Customer Support : 09738383344
Foreign Functions
▪ Retrieve Data from other
Symbols
DEMO
www.marketcalls.in Customer Support : 09738383344
Offers to Webinar Participants
Globaldatafeeds
▪ Take Data Subscription of NSE
MCX NSE FX
www.marketcalls.in/services
Contact Customer Support
09738383344
SupportTimings – (9a.m – 6p.m)
Mon - Fri
Tradejini ( Discount Broker )
▪ Get 50% of Brokerage Reversal
upto your purchased product
▪ Rs 20 Per Order
▪ Trade in NSE, BSE, MCX, MCX-
SX
▪ Nest/NowTradingTerminal
www.marketcalls.in Customer Support : 09738383344
Recommended Trading Books
Beginners
• Introduction to Amibroker – 2nd Edition – Howard Bandy
• Amibroker User Guide
Intermediate
• QuantitativeTrading Systems – Howard Bandy
• ModellingTrading System Performance – Howard Bandy
Experts
• Mean ReversionTrading Systems – Howard Bandy
• QuantitativeTechnical Analysis – Howard Bandy
www.marketcalls.in Customer Support : 09738383344
AFL Library & Forums
▪ Amibroker Library
www.amibroker.com/library
▪ Marketcalls Library
www.marketcalls.in/library
▪ Wisestocktrader Library
www.wisestocktrader.com
▪ AmibrokerYahoo Groups
▪ Traderji Forum
▪ Inditraders Forum
▪ Marketcalls Community
www.marketcalls.in Customer Support : 09738383344
Questions
www.marketcalls.in Customer Support : 09738383344
ThankYou
www.marketcalls.in Customer Support : 09738383344

More Related Content

PPSX
Best strategies for trading
TeyYeeShen
 
PPTX
Monte Carlo Simulation for Trading System in AmiBroker
ThaiQuants
 
PDF
High Probability Trading Setups
btrader
 
PDF
All you need to know.pdf
HungLe593957
 
PDF
Simple trading strategy for beginners
pipsumo traderfx
 
PDF
Trading plan
pipsumo traderfx
 
PPTX
Top 8 Forex Trading Strategies That Pro Traders Use
Syrous Pejman
 
PDF
Magic Breakout Forex Trading Strategy PDF eBook
eforexcourse web
 
Best strategies for trading
TeyYeeShen
 
Monte Carlo Simulation for Trading System in AmiBroker
ThaiQuants
 
High Probability Trading Setups
btrader
 
All you need to know.pdf
HungLe593957
 
Simple trading strategy for beginners
pipsumo traderfx
 
Trading plan
pipsumo traderfx
 
Top 8 Forex Trading Strategies That Pro Traders Use
Syrous Pejman
 
Magic Breakout Forex Trading Strategy PDF eBook
eforexcourse web
 

What's hot (20)

PDF
Introduction to forex
Michael Markidis
 
PPTX
Mean Reversion
Forex Useful
 
PPTX
Relative Strength Index
RajaKrishnan M
 
PDF
ICT Mentorship Month 1 Notes.pdf
JayanthiWickramarath
 
PDF
FOREX ICT & MMM NOTES.pdf
HungLe593957
 
PDF
Smart-Money for SMC traders good time and ICT
simonomuemu
 
PDF
Secrets of Price Action Trading
Syrous Pejman
 
PPTX
Cryptocurrency
ShreyasSumeshMenon
 
PPT
Psychology of Trading
sumeetsj
 
PDF
Forex trading
eduCBA
 
PDF
Candlestick cheat-sheet-rgb-final
Michael Kleven
 
PPTX
DIY Quant Strategies on Quantopian
Jess Stauth
 
PDF
Magic Forex breakout
pipsumo traderfx
 
PDF
Bystra GOLD.pdf
ssuser29de0b
 
PPTX
SUPPORT AND RESISTANCE INDICATOR
StockTradeTutor
 
PDF
40 pip parabolic sar forex strategy (1)
pipsumo traderfx
 
PDF
mastering-candlestick-charts-part-i
BoyEnvi BoyEnvi
 
PDF
Mean Reversion Trading System: Practical Methods for Swing Trading
siyunoyip
 
PDF
Best Swing Trading Indicators and Oscillators
SwingTradingBootCamp
 
PDF
Learn A Simple Range Trading Strategy
NetpicksTrading
 
Introduction to forex
Michael Markidis
 
Mean Reversion
Forex Useful
 
Relative Strength Index
RajaKrishnan M
 
ICT Mentorship Month 1 Notes.pdf
JayanthiWickramarath
 
FOREX ICT & MMM NOTES.pdf
HungLe593957
 
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Secrets of Price Action Trading
Syrous Pejman
 
Cryptocurrency
ShreyasSumeshMenon
 
Psychology of Trading
sumeetsj
 
Forex trading
eduCBA
 
Candlestick cheat-sheet-rgb-final
Michael Kleven
 
DIY Quant Strategies on Quantopian
Jess Stauth
 
Magic Forex breakout
pipsumo traderfx
 
Bystra GOLD.pdf
ssuser29de0b
 
SUPPORT AND RESISTANCE INDICATOR
StockTradeTutor
 
40 pip parabolic sar forex strategy (1)
pipsumo traderfx
 
mastering-candlestick-charts-part-i
BoyEnvi BoyEnvi
 
Mean Reversion Trading System: Practical Methods for Swing Trading
siyunoyip
 
Best Swing Trading Indicators and Oscillators
SwingTradingBootCamp
 
Learn A Simple Range Trading Strategy
NetpicksTrading
 
Ad

Viewers also liked (20)

PPTX
Amibroker afl coding 28th atma bengaluru meet
Marketcalls
 
PPTX
Coimbatore amibroker workshop 2014
Marketcalls
 
PDF
AmiBroker ApplyStop Introduction
ThaiQuants
 
DOCX
AmiBroker AFL to DLL Conversion
afl2dll
 
PDF
Understand Foreign Equity in AmiBroker
ThaiQuants
 
PDF
A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...
siamquant
 
PDF
AmiBroker Buy sell target & stop loss trading signals software for equity, co...
Vishnu Kumar
 
PDF
Atma sphere april 2014 (1)
Nikhil Dogra
 
PDF
Improving Your Trading Plan
Benjamin Cheeks
 
PDF
SiamQuant 2.0 Discovering Alphas Annoucement : จงค้นหา แล้วจะค้นพบ! เริ่มต้นว...
siamquant
 
PDF
Does P/E Band Really Work!? : บททดสอบกลยุทธ์การลงทุนด้วย P/E Band
siamquant
 
PPT
Plan your trade,trade your plan
andy6898
 
PPTX
Trading system designer
Rodrigo Sucupira
 
PPTX
Transition to a_hedge fund_-_wsi
kevinWSI
 
PPTX
Fears, Emotions & Market Crash
Marketcalls
 
PDF
Tips for Tuning Solr Search: No Coding Required
Acquia
 
PPT
Technology Edge in Algo Trading: Traditional Vs Automated Trading System Arch...
QuantInsti
 
PDF
Saral Gyan - 15% @ 90 Days - April 2016
SaralGyanTeam
 
PDF
Saral Gyan Hidden Gem - Dec 2012
SaralGyanTeam
 
PDF
Saral Gyan Hidden Gem - Sept 2014
SaralGyanTeam
 
Amibroker afl coding 28th atma bengaluru meet
Marketcalls
 
Coimbatore amibroker workshop 2014
Marketcalls
 
AmiBroker ApplyStop Introduction
ThaiQuants
 
AmiBroker AFL to DLL Conversion
afl2dll
 
Understand Foreign Equity in AmiBroker
ThaiQuants
 
A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...
siamquant
 
AmiBroker Buy sell target & stop loss trading signals software for equity, co...
Vishnu Kumar
 
Atma sphere april 2014 (1)
Nikhil Dogra
 
Improving Your Trading Plan
Benjamin Cheeks
 
SiamQuant 2.0 Discovering Alphas Annoucement : จงค้นหา แล้วจะค้นพบ! เริ่มต้นว...
siamquant
 
Does P/E Band Really Work!? : บททดสอบกลยุทธ์การลงทุนด้วย P/E Band
siamquant
 
Plan your trade,trade your plan
andy6898
 
Trading system designer
Rodrigo Sucupira
 
Transition to a_hedge fund_-_wsi
kevinWSI
 
Fears, Emotions & Market Crash
Marketcalls
 
Tips for Tuning Solr Search: No Coding Required
Acquia
 
Technology Edge in Algo Trading: Traditional Vs Automated Trading System Arch...
QuantInsti
 
Saral Gyan - 15% @ 90 Days - April 2016
SaralGyanTeam
 
Saral Gyan Hidden Gem - Dec 2012
SaralGyanTeam
 
Saral Gyan Hidden Gem - Sept 2014
SaralGyanTeam
 
Ad

Similar to Amibroker AFL Coding - Webinar (20)

PDF
Scaling operations in the Subscription Economy (Brandwatch)
Zuora, Inc.
 
PDF
TMPA-2017: Defect Report Classification in Accordance with Areas of Testing
Iosif Itkin
 
PDF
Increasing reporting value with statistics
vraopolisetti
 
PPTX
Quantitative finance 101
Martin Froehler
 
PPTX
Quantitative finance 101
Martin Froehler
 
PDF
Testing trading strategies in JavaScript
Ashley Davis
 
PDF
Speed of Lightning
Salesforce Developers
 
PDF
Rebuilding the Busiest Trading Exchange in the World to Scale 10X (Manjunath ...
confluent
 
PDF
Ncdex tips
Ncdex Commodity
 
PDF
, NCDEX POSITIONAL TIPS
Ncdex Commodity
 
PDF
20161110 quantstrat in seattle
Chia-Chi Chang
 
PDF
Trading decision trees ( Elaborated by Mohamed DHAOUI )
Mohamed DHAOUI
 
PDF
Business Valuation PowerPoint Presentation Slides
SlideTeam
 
PPT
This Help you for Earning
Laxmikant Jagtap
 
PPT
StrikeZone-01
John Car
 
PDF
How To Forex trade with sucess - Caliber FX Pro - System Manual
island script
 
PPTX
Vertical Recommendation Using Collaborative Filtering
gorass
 
PDF
Business Valuation Powerpoint Presentation Slides
SlideTeam
 
PDF
Daily Derivative Report
Money Classic Research
 
PPTX
Execution plans for mere mortals
Mike Lawell
 
Scaling operations in the Subscription Economy (Brandwatch)
Zuora, Inc.
 
TMPA-2017: Defect Report Classification in Accordance with Areas of Testing
Iosif Itkin
 
Increasing reporting value with statistics
vraopolisetti
 
Quantitative finance 101
Martin Froehler
 
Quantitative finance 101
Martin Froehler
 
Testing trading strategies in JavaScript
Ashley Davis
 
Speed of Lightning
Salesforce Developers
 
Rebuilding the Busiest Trading Exchange in the World to Scale 10X (Manjunath ...
confluent
 
Ncdex tips
Ncdex Commodity
 
, NCDEX POSITIONAL TIPS
Ncdex Commodity
 
20161110 quantstrat in seattle
Chia-Chi Chang
 
Trading decision trees ( Elaborated by Mohamed DHAOUI )
Mohamed DHAOUI
 
Business Valuation PowerPoint Presentation Slides
SlideTeam
 
This Help you for Earning
Laxmikant Jagtap
 
StrikeZone-01
John Car
 
How To Forex trade with sucess - Caliber FX Pro - System Manual
island script
 
Vertical Recommendation Using Collaborative Filtering
gorass
 
Business Valuation Powerpoint Presentation Slides
SlideTeam
 
Daily Derivative Report
Money Classic Research
 
Execution plans for mere mortals
Mike Lawell
 

More from Marketcalls (20)

PPTX
Trading API and Automation – Quantageddon 2.0 @ IIT Chennai
Marketcalls
 
PPTX
OpenAlgo - Algotrading Platform for Everyone
Marketcalls
 
PPTX
Python for Traders - Introduction to Python for Trading
Marketcalls
 
PPTX
Line Trading Automation - Algomojo Amibroker Module
Marketcalls
 
PPTX
Introduction to Option Greeks
Marketcalls
 
PDF
New margin requirement for popular futures and options strategies
Marketcalls
 
PPTX
Tradestudio 5.0 - Documentation
Marketcalls
 
PDF
Trading Money on 2nd OCT 2019 - Market Outlook
Marketcalls
 
PPTX
Trading money on 22nd sep 2019
Marketcalls
 
PPTX
Budget 2019 - Nifty Futures Intraday Price Action
Marketcalls
 
PPTX
Trading options and market profile
Marketcalls
 
PPTX
Custom Algo Development - Marketcalls
Marketcalls
 
PPTX
Tradezilla 2.0 - Discover Your Trading Edge Using Market Profile and Orderflow
Marketcalls
 
PPTX
Trading Strategies for Active Traders
Marketcalls
 
PDF
Marketcalls slack 24th dec 2018
Marketcalls
 
PPTX
Introduction to Algoaction -Web Based Trading Platform
Marketcalls
 
PPTX
Amibroker Fast Track Course Bangalore
Marketcalls
 
PPTX
Market profile - ATMA 42nd Educational Meeting
Marketcalls
 
PPTX
LinTRA – Intraday Trading System
Marketcalls
 
PPTX
TradeZilla - Trading system Design
Marketcalls
 
Trading API and Automation – Quantageddon 2.0 @ IIT Chennai
Marketcalls
 
OpenAlgo - Algotrading Platform for Everyone
Marketcalls
 
Python for Traders - Introduction to Python for Trading
Marketcalls
 
Line Trading Automation - Algomojo Amibroker Module
Marketcalls
 
Introduction to Option Greeks
Marketcalls
 
New margin requirement for popular futures and options strategies
Marketcalls
 
Tradestudio 5.0 - Documentation
Marketcalls
 
Trading Money on 2nd OCT 2019 - Market Outlook
Marketcalls
 
Trading money on 22nd sep 2019
Marketcalls
 
Budget 2019 - Nifty Futures Intraday Price Action
Marketcalls
 
Trading options and market profile
Marketcalls
 
Custom Algo Development - Marketcalls
Marketcalls
 
Tradezilla 2.0 - Discover Your Trading Edge Using Market Profile and Orderflow
Marketcalls
 
Trading Strategies for Active Traders
Marketcalls
 
Marketcalls slack 24th dec 2018
Marketcalls
 
Introduction to Algoaction -Web Based Trading Platform
Marketcalls
 
Amibroker Fast Track Course Bangalore
Marketcalls
 
Market profile - ATMA 42nd Educational Meeting
Marketcalls
 
LinTRA – Intraday Trading System
Marketcalls
 
TradeZilla - Trading system Design
Marketcalls
 

Recently uploaded (20)

PDF
Danielle Oliveira New Jersey - A Seasoned Lieutenant
Danielle Oliveira New Jersey
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Gregory Felber - An Accomplished Underwater Marine Biologist
Gregory Felber
 
PDF
NewBase 29 July 2025 Energy News issue - 1807 by Khaled Al Awadi_compressed.pdf
Khaled Al Awadi
 
PDF
MDR Services – 24x7 Managed Detection and Response
CyberNX Technologies Private Limited
 
PPTX
Integrative Negotiation: Expanding the Pie
badranomar1990
 
PDF
North America’s GSE Market Share Outlook Through 2029.pdf
Amrut47
 
PDF
Followers to Fees - Social media for Speakers
Corey Perlman, Social Media Speaker and Consultant
 
PPTX
Final PPT on DAJGUA, EV Charging, Meter Devoloution, CGRF, Annual Accounts & ...
directord
 
PPTX
Final PPT on DAJGUA, EV Charging, Meter Devoloution, CGRF, Annual Accounts & ...
directord
 
PDF
Bihar Idea festival - Pitch deck-your story.pdf
roharamuk
 
PPTX
Virbyze_Our company profile_Preview.pptx
myckwabs
 
PDF
askOdin - An Introduction to AI-Powered Investment Judgment
YekSoon LOK
 
PPTX
Certificate of Incorporation, Prospectus, Certificate of Commencement of Busi...
Keerthana Chinnathambi
 
PDF
Data Sheet Cloud Integration Platform - dataZap
Chainsys SEO
 
PDF
2025 07 29 The Future, Backwards Agile 2025.pdf
Daniel Walsh
 
PDF
What are the steps to buy GitHub accounts safely?
d14405913
 
PPTX
Chapter 3 Distributive Negotiation: Claiming Value
badranomar1990
 
PPTX
Appreciations - July 25.pptxsdsdsddddddsssss
anushavnayak
 
DOCX
India's Emerging Global Leadership in Sustainable Energy Production The Rise ...
Insolation Energy
 
Danielle Oliveira New Jersey - A Seasoned Lieutenant
Danielle Oliveira New Jersey
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Gregory Felber - An Accomplished Underwater Marine Biologist
Gregory Felber
 
NewBase 29 July 2025 Energy News issue - 1807 by Khaled Al Awadi_compressed.pdf
Khaled Al Awadi
 
MDR Services – 24x7 Managed Detection and Response
CyberNX Technologies Private Limited
 
Integrative Negotiation: Expanding the Pie
badranomar1990
 
North America’s GSE Market Share Outlook Through 2029.pdf
Amrut47
 
Followers to Fees - Social media for Speakers
Corey Perlman, Social Media Speaker and Consultant
 
Final PPT on DAJGUA, EV Charging, Meter Devoloution, CGRF, Annual Accounts & ...
directord
 
Final PPT on DAJGUA, EV Charging, Meter Devoloution, CGRF, Annual Accounts & ...
directord
 
Bihar Idea festival - Pitch deck-your story.pdf
roharamuk
 
Virbyze_Our company profile_Preview.pptx
myckwabs
 
askOdin - An Introduction to AI-Powered Investment Judgment
YekSoon LOK
 
Certificate of Incorporation, Prospectus, Certificate of Commencement of Busi...
Keerthana Chinnathambi
 
Data Sheet Cloud Integration Platform - dataZap
Chainsys SEO
 
2025 07 29 The Future, Backwards Agile 2025.pdf
Daniel Walsh
 
What are the steps to buy GitHub accounts safely?
d14405913
 
Chapter 3 Distributive Negotiation: Claiming Value
badranomar1990
 
Appreciations - July 25.pptxsdsdsddddddsssss
anushavnayak
 
India's Emerging Global Leadership in Sustainable Energy Production The Rise ...
Insolation Energy
 

Amibroker AFL Coding - Webinar

  • 1. Amibroker AFL Coding Rajandran R www.marketcalls.in
  • 2. Disclaimer ▪ TRADING FUTURES AND OPTIONS INVOLVES SUBSTANTIAL AMOUNT OF RISK OF LOSS AND IS NOT SUITABLE FOR ALL INVESTORS ▪ PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS. ▪ AMIBROKER IS REGISTEREDTRADEMARK OF AMIBROKER.COM. ▪ WE ARE NEITHER ASSOCIATED WITHTHE ABOVETRADEMARK OWNERS NOR DOWE REPRESENT THEM IN ANY MANNER. WE ARE NOT OFFERING AMIBROKER PLATFORM FOR SALE ON OURWEBSITE / IN OUR OFFICE. www.marketcalls.in Customer Support : 09738383344
  • 3. About Me ▪ Running a Financial Start-up ▪ Author of www.marketcalls.in since Sep 2007 ▪ Trading System Designer ▪ SystemTrader & Financial Blogger ▪ More www.marketcalls.in/about www.marketcalls.in Customer Support : 09738383344
  • 4. No Subjective Interpretation ▪ NoTrend Lines ▪ No Gann ▪ No Fibonacci ▪ No Elliot wave ▪ NoTrading Patterns ▪ No Divergence ▪ No News ▪ No Fundamentals www.marketcalls.in Customer Support : 09738383344
  • 5. Trading Analysis Software Amibroker Metastock Ninjatrader Esignal Multicharts www.marketcalls.in Customer Support : 09738383344
  • 6. Free Data Providers for Amibroker Google Finance (EOD, Intraday) Yahoo Finance (EOD, Intraday, Fundamental) ASCII (csv, txt) MSN Money (EOD) Quandl (EOD) www.marketcalls.in Customer Support : 09738383344
  • 7. Subscription based Data Providers Globaldatafeeds Neotradeanalytics Esignal (Platform + Data feed) DTN IQFeed Interactive Brokers (Brokerage + Data feed ) CQG www.marketcalls.in Customer Support : 09738383344
  • 8. Why Amibroker? ▪ Ease of Use ▪ High Speed Execution ▪ Supports Autotrading (Symphony Fintech, Interactive Brokers) ▪ CustomTimeframe ▪ MultiTimeframe Support ▪ Backtesting Optimization Walk ForwardTesting ▪ Scanning and Exploration ▪ Custom Indicators (AFL Programming) www.marketcalls.in Customer Support : 09738383344
  • 9. Amibroker Formula Language (AFL) www.marketcalls.in Customer Support : 09738383344 ▪ AFL is Vector Programming Language ▪ Write your own Custom Indicators, Scanners, Exploration and custom commentaries ▪ Write your ownTrading System Rules
  • 10. AFL Tokens ▪ Identifiers ▪ Constants ▪ String – literals ▪ Operators ▪ Punctuators (Separators) www.marketcalls.in Customer Support : 09738383344
  • 11. Built-in Identifiers Identifiers Abbreviation Open O High H Low L Close C Volume V OpenInt OI Avg www.marketcalls.in Customer Support : 09738383344
  • 12. Comparison Operators Symbol Meaning < Less than > Greater than <= Less than or equal to >= Greater than or equal to == Equal to ! Not != Not Equal to www.marketcalls.in Customer Support : 09738383344
  • 13. Arithmetic and Logical Operators Symbol Meaning + Addition - Subtraction * Multiplication / Division % Modulus ^ Exponentiation | & BitwiseOR BitwiseAND www.marketcalls.in Customer Support : 09738383344 Symbol Meaning NOT Logical NOT AND LogicalAND OR Logical OR
  • 14. Sample Built-in Functions ▪ RSI(14) - 14 period RSI ▪ MACD() - Default MACD ▪ EMA(c,10) - 10 period EMA ▪ Ref(C, -1 ) - Previous Close Array ▪ MA(C,25) - 25 period Simple MA ▪ Cross(C, EMA(c10)) - Crossover Functions ▪ Barindex() - returns total number of bars (similar to Barcount) More at http://www.amibroker.com/guide/a_funref.html www.marketcalls.in Customer Support : 09738383344
  • 16. AFL Arrays Example 1 www.marketcalls.in Customer Support : 09738383344 Day 1 2 3 4 5 6 7 8 9 10 1 Open 123 124 121 126 124 129 133 132 135 137 2 High 124 127 125 129 125 129 135 135 137 129 3 Low 120 121 119 120 121 124 130 128 131 127 4 Close 123 126 124 128 125 125 131 130 132 128 5 Volume 8310 3021 5325 2834 1432 5666 7847 555 6749 3456 6 Ref(C-1) NULL 123 126 124 128 125 125 131 130 132
  • 17. Pattern Detection Functions ▪ Inside() ▪ Outside() ▪ GapUp() ▪ GapDown() Gives a "1" or “True” when a inside Pattern occurs. Gives "0" or “False” otherwise. www.marketcalls.in Customer Support : 09738383344
  • 18. Plot Functions ▪ Plot() ▪ PlotOHLC() ▪ PlotShapes() Demo www.marketcalls.in Customer Support : 09738383344
  • 19. Plot Arrows /* Plot Buy and Sell SignalArrows */ PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50); PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50); PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45); www.marketcalls.in Customer Support : 09738383344
  • 20. AFL Arrays Example 2 www.marketcalls.in Customer Support : 09738383344 Day 1 2 3 4 5 6 7 8 9 10 1 Open 123 124 121 126 124 129 133 132 135 137 2 BeginValue( Open ) 124 124 124 124 124 124 124 124 124 124 3 EndValue( Open ) 132 132 132 132 132 132 132 132 132 132 4 SelectedValue(Open ) 121 121 121 121 121 121 121 121 121 121 5 LastValue( Open ) 137 137 137 137 137 137 137 137 137 137 6 Close 122 126 123 128 125 125 131 130 132 128
  • 21. Lowest/Highest Functions ▪ LLV() ▪ HHV() ▪ Lowest() ▪ Highest() ▪ LLV(C,10) ▪ HHV(c,10) ▪ Lowest( RSI(14)) ▪ Highest( MFI(14) ) DEMO www.marketcalls.in Customer Support : 09738383344
  • 22. Alerts (in built and 3rd Party) ▪ SoundAlert ▪ Voice Alert ▪ Email Alert ▪ Alertif() , say() functions ▪ Twitter Alert [tweetymail] ▪ Trade Sender ▪ Push Bullet [http api] www.marketcalls.in Customer Support : 09738383344
  • 23. Param Control Functions ▪ Param() ▪ Paramcolor() ▪ Paramstr() ▪ ParamTime() ▪ ParamDate() ▪ ParamField() ▪ ParamTrigger() ▪ ParamList() ▪ ParamToggle() ▪ ParamStyle() DEMO www.marketcalls.in Customer Support : 09738383344
  • 24. Built-in Trading Logic Identifiers ▪ Buy ▪ Sell ▪ Short ▪ Cover DEMO www.marketcalls.in Customer Support : 09738383344
  • 25. Simple Exploration www.marketcalls.in Customer Support : 09738383344 Filter =1; AddColumn(RSI(10),"RSI", 1.2); AddColumn(EMA(C,10),"EMA10",1.2); AddColumn(v,"volume",1);
  • 26. Understanding different IF Functions ▪ IF ▪ IIF ▪ WriteIF ▪ If(buy[barcount-1] == true) ▪ Color = iif(RSI(14)>70,colorgreen,colorred) www.marketcalls.in Customer Support : 09738383344
  • 27. Multitimeframe Functions SwitchingTimeframe • TimeFrameSet • TimeFrameRestore Compress/Expand • TimeFrameCompress • TimeFrameExpand Access DiffTimeframe • TimeFrameGetPrice www.marketcalls.in Customer Support : 09738383344
  • 28. Multimeframe Getprice TimeFrameGetPrice( "O", inWeekly, -1 ) // gives you previous week Open price TimeFrameGetPrice( "C", inWeekly, -3 ) // gives you weekly Close price 3 weeks ago TimeFrameGetPrice( "H", inWeekly, -2 ) // gives you weekly High price 2 weeks ago TimeFrameGetPrice( "O", inWeekly, 0 ) // gives you this week Open price. TimeFrameGetPrice( "H", inDaily, -1 ) // gives previous Day High when working on intraday data www.marketcalls.in Customer Support : 09738383344
  • 29. Components of Trading System Initial Parameters Trading Logic Position Size Signals & Alerts Dashboard www.marketcalls.in Customer Support : 09738383344
  • 30. Simple Trading System SetTradeDelays(1,1,1,1); SetPositionSize(100,spsShares); par1 = param("par1",10,1,50,1); par2 = param("par2",15,1,50,1); sema = EMA(C,par1); lema = EMA(C,par2); Buy = Cross(sema,lema); Sell = Cross(lema,sema); www.marketcalls.in Customer Support : 09738383344
  • 31. Position Size & Trade Delay ▪ SetTradeDelays(1,1,1,1); //Trade Delay of 1 Bar ▪ SetPositionSize( 100, spsShares ); // 100 shares by default ▪ SetPositionSize( 10, spsPercentofEquity ); //Percentage Equity ▪ SetPositionSize( 100000, spsValue ); // Fixed Amount http://www.amibroker.com/kb/2014/10/12/position-sizing-based-on- risk/ www.marketcalls.in Customer Support : 09738383344
  • 34. Trading System Design Cycle Analysis Design ImplementTesting Evaluate www.marketcalls.in Customer Support : 09738383344
  • 35. Time Based Trading Rules ▪ Timenum() Function ▪ Mostly Rules for Intraday DEMO www.marketcalls.in Customer Support : 09738383344
  • 36. Foreign Functions ▪ Retrieve Data from other Symbols DEMO www.marketcalls.in Customer Support : 09738383344
  • 37. Offers to Webinar Participants Globaldatafeeds ▪ Take Data Subscription of NSE MCX NSE FX www.marketcalls.in/services Contact Customer Support 09738383344 SupportTimings – (9a.m – 6p.m) Mon - Fri Tradejini ( Discount Broker ) ▪ Get 50% of Brokerage Reversal upto your purchased product ▪ Rs 20 Per Order ▪ Trade in NSE, BSE, MCX, MCX- SX ▪ Nest/NowTradingTerminal www.marketcalls.in Customer Support : 09738383344
  • 38. Recommended Trading Books Beginners • Introduction to Amibroker – 2nd Edition – Howard Bandy • Amibroker User Guide Intermediate • QuantitativeTrading Systems – Howard Bandy • ModellingTrading System Performance – Howard Bandy Experts • Mean ReversionTrading Systems – Howard Bandy • QuantitativeTechnical Analysis – Howard Bandy www.marketcalls.in Customer Support : 09738383344
  • 39. AFL Library & Forums ▪ Amibroker Library www.amibroker.com/library ▪ Marketcalls Library www.marketcalls.in/library ▪ Wisestocktrader Library www.wisestocktrader.com ▪ AmibrokerYahoo Groups ▪ Traderji Forum ▪ Inditraders Forum ▪ Marketcalls Community www.marketcalls.in Customer Support : 09738383344