### Study drawing tools

AmiBroker's study drawing tools are accessible from Draw / Fibonacci & Gann toolbars:

 The following tools are available: trend line ray (new in 4.20) extended line (new in 4.20) vertical line horizontal line parallel lines (new in 4.20) Regression channels: Raff, standard deviation, standard error (all new in 4.20) Fibonacci Retracement study (enhanced in 4.20) Fibonacci Time zones study Fibonacci Extensions (new in 4.60) Fibonacci Time Extensions (new in 4.60) Fibonacci Fan Fibonacci arc Gann Square (new in 4.20) Gann Fan (new in 4.20) Ellipse tool Triangle tool (new in 4.30) Andrews' pitchfork (new in 4.30) Cycles tool (new in 4.60) Arrow tool (new in 4.70) Zig-zag tool (new in 4.70) Arc tool Rectangle text box tool The default Select tool (red arrow) is used to select drawing objects and quotations on the chart. If you want to draw given study just switch on appropriate button and start drawing on the chart by pointing the mouse where you want to start the drawing and click-and-hold left mouse button. Then move the mouse. Study tracking line will appear. Release left mouse button when you want to finish drawing. You can also cancel study drawing by pressing ESC (escape) key. For beginners' guide to charting check Tutorial: Charting guide

Trend line, Ray, Extended, Vertical, Horizontal

These tools give different flavours of basic trend line. Trend line gives a line segment, Ray gives right-extended trend line, Extended gives trend line that is extended automatically from both left- and right- sides. Vertical and Horizontal are self-explaining.

Arrow

Similar to Trend line but ends with an arrow

Zig-zag

Draws a series of connected trend lines. To end drawing press ESC key.

Parallel

This tool allows to draw a series of parallel trend line segments. First you draw a trend line as usual, then a second line parallel to the first is automatically created and you can move them around with the mouse. Once you click on the chart it is placed in given position. Then another parallel line appears that can be placed somewhere else. And again, and again. To stop this please either press ESC key or choose "Select" tool.

Regression channels

AmiBroker allows to draw easily 3 kinds of regression channels:

• Raff regression channel
• Standard error channel
• Standard deviation channel

All these channels are based on linear regression trend line.

The Regression Channel is constructed by plotting two parallel, equidistant lines above and below a Linear Regression trendline. The distance between the channel lines to the regression line is the greatest distance that any one high or low price is from the regression line.

Standard Error Channels are constructed by plotting two parallel lines above and below a linear regression trendline. The lines are plotted a specified number of standard errors away from the linear regression trendline.

Standard Deviation Channels are constructed by plotting two parallel lines above and below a linear regression trendline. The lines are plotted a specified number of standard errors away from the linear regression trendline.

You can choose the type of channel by double clicking on the channel study (or choosing Properties from right mouse button menu)

If Use common color and style box is marked channel lines use the same style and color as regression (middle) line. If it is not marked you can set separate colors and style for upper and lower channel line. You can also switch off completely upper and lower channel lines by unticking Show Upper line and Show Lower line boxes.

"Study ID" column defines study identifier that can be used in your custom formulas to detect crossovers. You can change these IDs if required by simple editing these fields. For more information on Study IDs check Tutorial: Using studies in AFL formulas

Ellipse and Arc drawing tools

These new drawing tools are connected to the date/price coordinates (as trend lines) rather than to the screen pixels so they can change the visual shape when displayed at various zoom factors or screen sizes.

To see the properties of these elements you should double-click on the clock-like 3, 6, 9 or 12 hour positions.

Fibonacci arc

This new drawing tool generates standard Fibonacci-arcs that are controlled by the trend line drawn with a dotted style. To see the properites of the arcs click on the controlling trend line.

Note that arc radius and central point are relative to the controlling trendline and because Fibonacci arcs must be circular regardless of screen size/resolution and zoom factor the position of the arcs may move in date/price domain.

Fibonacci retracement

First please note that Fibonacci tool works differently depending on the direction of drawing and "show extensions" flag. See the pictures below.

 Upward drawing direction Show Extensions ON Upward drawing direction Show Extensions OFF

as you can see it shows both retrace levels (38.2, 50, 61.8) and extension levels (127.2, 161.8). If "show extensions" box is OFF the tool shows ONLY retrace levels. It works in a similar way when controlling trend line is drawn downwards.

 Downward drawing direction Show Extensions ON Downward drawing direction Show Extensions OFF

Now more about Fibonacci settings window:

First column "Show" switches particular line ON/OFF
Second column "Level (%)" defines percentage level. 100 and 0 represent Y-coordinate
of begin and end points of controlling trend line.
Third column "Color" defines color of the line, Fourth column "Style" allows
to choose between regular, thick and dotted styles.

Fifth and Sixth columns "Left side" and "Right side" control display of text
that appear on the left and right side of the Fibonacci level line. Empty - means no text,
% - means percentage level, \$ - means dollar (point) level.

Seventh column "Study ID" defines study identifier that can be used in your custom formulas
to detect crossovers. Each Fibonacci level has a separate ID be default F0... F9.
You can change these IDs if required by simple editing these fields.

As described in User's Guide: Tutorial: Using studies in AFL formulas

you can easity write the formula that checks for penetration of particular Fibonacci level.
In this example we will detect if the closing price drops F2 (38.2% retracement) level line. The formula is very simple:
`sell = cross( study( "F2" ), close );`
Note that study() function accepts two arguments: the first is StudyID two letter code that corresponds to one given in properites dialog; the second argument is chart ID - by default it is 1 (when it is not given at all) and then it references the studies drawn in the main price pane. For checking studies drawn in other panes you should use the codes given above (in the table describing study() function).
Please note that this formula is universal - it will use appropriate level from any symbol that has Fibonacci lines drawn.
This is so because AmiBroker keeps data of all studies drawn in its database.
When you scan using above code - AmiBroker checks if Fibonacci levels are drawn for symbol being currently scanned,
if it finds one - it looks what F2 study is - it finds that this is a fibonacci line 38.2% located (for example for particular symbol) at \$29.06
so AmiBroker internally substitutes study( "F2" ) by \$29.06 (caveat: this is simplification - in fact it internally generates array that represents a trend line) and checks for cross.

"Extension factor" decides how far lines are right-extended (in X-axis direction). If you enter 2 you will get lines extended twice as much as default '1'. If you enter 0 Fibonacci level lines will end where controlling trend line ends.

"Use as default" - if you check this box and accept the settings by clicking OK - all Fibonacci drawings that you will draw later will use these settings.

When using text box tool just type the text in the box, when you want to finish click outside the text box. You can also cancel editing by pressing ESC key.

Fibonacci Extensions

The Fibonacci Extensions tool is similar to the Fibonacci Retracements tool. The Fibonacci Extensions tool requires a third point. The extensions and retracement levels are drawn from this third point, but based upon the distance between the first two points. A common use of this tool is to first connect two points that represent the endpoints of a major trend (or wave). Then choose the third point to be the endpoint of a retracement of that trend. Extensions are then drawn in the direction of the initial trend, from the third point, using the distance between points one and two as a basis for the extension levels.

The Fibonacci Extensions toolbar button and drawing tool work much like the Andrew's Pitchfork drawing tool. First, click on the Fibonacci Extension button on the toolbar. Then, click three times, once on each of the points that are involved in the Fibonacci Extension. The first click should be on the starting point of the initial trendline. The second click should be on the ending point of the initial trendline. The third click should be on the ending bar of the retracement period.

As with Fibonacci Retracements, there is a great deal of flexibility via Fibonnacci settings tab available after clicking on the study with a right mouse and selecting "Properties" from the context menu.

Fibonacci Time Extensions

Fibonacci Time Extensions tool is used to specify vertical lines at date/time levels which are determined to be probable values of changes in trend based on the market’s previous date/time range and a third extension point.

The time extension tool should be used as follows. First, click on the Fibonacci Time extension button on the toolbar. Then select the first range point (typically a major top or bottom of a market) by clicking on the chart where you want the range to begin, then move the mouse pointer to select the second range point by again clicking on the chart where you want the range to end. Extension lines now will be drawn onto the future bars.

As in Fibonacci Price retracement and extensions tools you have complete control over which percentages are used in the Time Extensions tool, and the colours of each of the extension values via Properites dialog.

Gann square and Gann Fan

Gann Squares indicate possible time and price movements from important highs and lows. To draw a Gann Square on a chart move the cursor on the chart to the starting point. The starting point is generally an important High or Low on the chart. Then drag the mouse to the right until a desired ending point is reached. The start and end points will be the corners of the square. The ending point is often to the right of the chart bars. Watch for trends to change directions at the Gann Square levels. As the Gann Square is drawn to the screen the angle of the controlling trend line is shown in the status bar.

Properties Window

The properties window is used to change the square levels, color, style, thickness, and defaults. Click on any of the Gann Square Show entries to add or remove lines. Click in the square color box to change the line color. Click on style combo boxes to change the line style. Check the Use as Default box to save the settings as the default for all subsequent Gann Squares that are drawn. "Left side" and "Right side" columns control display of text that appear on the left and right side of the Gann lines. Empty - means no text, % - means percentage level, \$ - means dollar (point) level. "Study ID" column defines study identifier that can be used in your custom formulas to detect crossovers. You can change these IDs if required by simple editing these fields. For more information on Study IDs check Tutorial: Using studies in AFL formulas

Triangle tool

Triangle tool is self-explaining. Drawing a triangle is easy: left-click at the first point, hold down and drag to the second point, then release mouse button and drag to the third point and click once. The controlling triangle will become the pitchfork.

Andrews' Pitchfork

Andrews pitchfork is a study using parallel trendlines. In constructing the study, starting points are chosen. The first is a major peak or trough on the left side of the chart display. The second and third starting points are chosen to be a major peak and a major trough to the right of the first point. After all starting points have been decided, AmiBroker draws a trendline from the first point (the most left) so that it passes directly between the right most points. This line is called the handle of the pitchfork. The second and third trend lines are drawn by AmiBroker beginning at the starting points and parallel to the handle. Dr. Andrews suggested that prices make it to the median line (or handle) about 80% of the time while the price trend is in place. This means that while the basic long term price trend remains intact, Dr. Andrews believed that the smaller trends in price would gravitate toward the median line while the larger price trend remained in tact. When that does not occur, it may be evidence that a reversal in the larger price trend may be in progress or provides evidence of a stronger bias at work in market. When price fails to make it to the medial line from either side, it is often an expression of the relative enthusiasm of buyers and sellers and may predict the next major direction of prices. If prices fail to reach the median line while above the median line, it is a bullish and failing to reach the median line from below is bearish.

Operating Andrews' Pitchfork tool is similar to drawing triangle. Left-click at the first point, hold down and drag to the second point, then release mouse button and drag to the third point and click once. The controlling triangle will become the pitchfork.

Cycles tool

To use time cycles tool, click on the cycles drawing tool button in the toolbar then click at the starting point of the cycle and drag to the end of the cycle. These two control points control the interval between the cycle lines. When you release the mouse button you will get a series of
parallel lines with equal interval in between them.