Amibroker Cheat Sheet v1.0-1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

AMIBROKER CHEAT SHEET

TRADING TUITIONS
Important Shortcuts
Shortcut Keys Purpose Shortcut Keys Purpose

ALT + RIGHT Open chart for the next symbol in CTRL + H Enable crosshair
ARROW KEY the database
CTRL + R View and edit chart
ALT + LEFT Open chart for the previous symbol parameters
ARROW KEY in the database
CTRL + E Edit formula
F3 Stock symbol finder by name or
ticket SHIFT + F1 Open contextual help
SHIFT + F1 Open contextual help F1 Open Help Window
F1 Open Help Window

HOME Scroll left in the chart

END Scroll right in the chart

CTRL + W Switch to weekly timeframe

CTRL + D Switch to daily timeframe

CTRL + M Switch to monthly timeframe

TRADING TUITIONS
Creating New Shortcut Keys
Go to Tools → Customize → Keyboard and assign a new shortcut key to
commonly used functions

TRADING TUITIONS
Useful Tips to Improve Performance of Amibroker
Hardware/Operating System

• Disable scanning of Amibroker data files from you anti-virus program.

• Keep you CPU and hard disk at the optimum level.

• Put your data onto a secondary SSD drive. Solid State Drives increase
performance significantly.

• Do not install any third party programs or softwares to improve performance.

• Install a 64-bit version of Windows so that you can use the 64-bit version of
Amibroker Professional Edition. 64-bit CPU operations are significantly quicker
than 32-bit.

• Upgrade to Intel i7 8700K CPU. AMD Ryzen 5/7 is a viable alternative too.

TRADING TUITIONS
Amibroker Settings

• Change the Amibroker settings for "In-memory cache size". This settings can be
found at Tools > Preferences > Data. If you have at least 2GB of RAM, you could
increase "Max. MegaBytes" to 1000. You may increase it more if your RAM
size is higher.

• The setting for "Max. Symbols" may also be increased to the limit of 20,000.
However, a run should never be performed on more symbols than is necessary.

• Try to keep number of bars to minimum value in File > Database Settings. Each
bar is equivalent to 40 bytes, so if your enter 50000 bars it will allocate 2MB
per symbol. For best performance, make sure that you don't exceed CPU on-
chip cache size, so if your CPU has 4MB cache, for best performance it is
strongly advised not to use more than 100000 bars in File->Database Settings.

• Monitor Amibroker's cache usage by clicking Tools > Performance Monitor.

TRADING TUITIONS
Backtesting/Optimization Level

• Use “Filter” option during backtesting, optimization and exploration to restrict


the number of symbols

• Try not to Optimize too many parameters at the same time. Limit your attempt
to two parameters at a time.

• If you have lots of optimization params (more than 10K combinations) use
smart optimizer (CMAE/PSO).

• You can also use “Individual Optimize” from Amibroker 5.7.0. It will use all
available processor cores to perform single-symbol optimization, making it
much faster than regular optimization.

• Another useful approach is to prefilter the watchlist based on some static set
of criteria. For example, if your strategy requires a minimum price of $5/share
and volume greater than 1M shares, then you can write a small exploration to
find only those stocks

TRADING TUITIONS
AFL Level

• Replace loops with Array processing. For example – C[n] refers to close price of
nth bar, rather C refers to an array containing close price of all the bars.

• Array version of the code can be up to 100 times faster than loop version.

• Look for readymade functions instead of rewriting the code.

• Use static variables judiciously.

• Functions like Equity/AddToComposite/Foreign can be performance intensive.


Do not over use them

• Use the AFL Formula Editor, Tools->Code check & Profile to find out which
functions are called how many times and which ones take the most time. Start
your code tuning with functions that are called the most often.

TRADING TUITIONS
Tips to Debug your AFL Code
When you are having problems with your code, reduce it to the smallest
1 snippet that still is problematic. Dividing and conquering always helps.

Use printf() function to write variable values into interpretation window.


2

Use detailed logging to see what backtester is doing on each internal bar
3

Use the inbuilt debugger. allows you to single-step thru your formula, set
4 breakpoints, watch the content of your variables and more

Use _TRACE() and _TRACEF() function to know the sequence of


5 operations your formula is doing and the values of variables

Use PLOT() function to visualize the content of the array


6

TRADING
TRADING TUITIONS
TUITIONS
Most commonly used AFL Functions
Function Name Syntax Purpose
IIF() IIf( expression, It returns the value of the second parameter if the conditional
YesValue, NoValue ) expression defined by the first parameter (EXPRESSION) is true;
otherwise, the value of third parameter is returned (FALSE_PART). It
works with both numbers (scalars) and arrays. When any of
arguments is an array it returns array.
ExRem() exrem( ARRAY1, It removes excessive signals. Returns 1 on the first occurrence of
ARRAY2 ) "true" signal in Array1 then returns 0 until Array2 is true even if
there are "true" signals in Array1

Param() Param( ''name'', Adds a new user-definable parameter, which can be accessed via
defaultval, min, max, Parameters dialog
step, sincr = 0 )

Plot() Plot( array, name, Plots the array in the chart


color)

TRADING TUITIONS
Function Name Syntax Purpose

AddColumn() AddColumn( array, Adds a columns to the exploration result set


name

Printf() printf( formatstr, ... ) Formats and prints a series of characters and values to the output
window

MA() ma( ARRAY, periods) Calculates the simple moving average of the array for the defined
period

MACD() macd(fast = 12, slow = Calculates moving average convergence divergence (MACD)
26) indicator using fast and slow periods

Error() Error("text") Stops the formula execution and displays user defined error
message

Now() Now(format) Returns current date/time

TimeFrameSet() TimeFrameSet( Switches to a different timeframe specified by interval parameter


interval)

TRADING TUITIONS
Best’s for Amibroker
Best EOD Data Source Norgate Data

Best Premium Realtime IQFeed


feed

Best low-cost Realtime Interactive Brokers


feed

Best CPU Configuration Intel i7 8700K OR AMD Ryzen 5/7

Best Books Howard Bandy's Quantitative Trading Systems and


Quantitative Technical Analysis

TRADING
TRADING TUITIONS
TUITIONS
In order to learn Amibroker and Trading system development from scratch
please visit
https://academy.tradingtuitions.com

TRADING
TRADING TUITIONS
TUITIONS

You might also like