API Reference
Namespaces
Classes
Events
Global
Externals

Class: elliottwave

CIQ.Drawing. elliottwave

Creates the Elliott Wave drawing tool.


new elliottwave()

Properties:
Name Type Argument Default Description
points array

Contains a sub-array of ticks and values for each point.

pts array

Contains a sub-array of pixel positions for the (x, y) coordinates of a point and the (x, y) annotation origin point.

annotationPoints array

Contains an annotation for each point along the wave. The length of the wave is determined by the length of this array. Always starts with 0.

dx number <optional>
0

X-axis offset value away from the point that determines the x-coordinate origin of the annotation.

dy number <optional>
-20

Y-axis offset value away from the point that determines the y-coordinate origin of the annotation.

dragToDraw boolean false

Sets the drawing mode to multi-point-draw rather than drag-to-draw. Elliott waves are multiple-point drawings; and so, are incompatible with dragging to draw points. See CIQ.Drawing#dragToDraw.

enclosedRadius number

The width of the largest text string enclosed in the wave annotations. By default undefined. See CIQ.Drawing.elliottwave#calculateRadius.

Version:
  • ChartIQ Advanced Package
Since:
  • 7.4.0

Extends

Members


chartsOnly :boolean

Set this parameter to true to restrict drawing from being rendered on a study panel.

This parameter may be set for all drawings, for a specific drawing type, or for a specific drawing instance. See examples.

Type:
  • boolean
Inherited From:
Overrides:
Example
// Set drawing instance to chartsOnly. Only this one drawing will be affected.
drawing.chartsOnly=true;
// Set a particular drawing prototype to chartsOnly. All drawings to type "difference" will be affected.
CIQ.Drawing["difference"].prototype.chartsOnly=true;
// Set all drawings to chartsOnly.
CIQ.Drawing.prototype.chartsOnly=true;

configs :Array.<string>

List of drawing settings to enable for this drawing. Some of the more common settings are: "color", "fillColor", "lineWidth", "pattern"; but for more complex drawings there are additional ones.

By resetting this array, you can control which settings are available for drawings of this type as well as any drawings that share the prototype with this drawing.

Type:
  • Array.<string>
Since:
  • 9.7.0

Inherited From:
Overrides:

dragToDraw :boolean

Used to set the user behavior for creating drawings.

By default, a drawing is created with this sequence:
move crosshair to staring pointclickmove crosshair to ending pointclick.

On a touch device this would be:
move crosshair to staring pointtapmove crosshair to ending pointtap.

Set dragToDraw to true to create the drawing with the following alternate sequence:
move crosshair to staring pointmousedowndragmouseup

On a touch device this would be:
move crosshair to staring pointpressdragrelease.

This parameter is not compatible with drawings requiring more than one drag movement to complete, such as:

  • Channel
  • Continuous Line
  • Elliott Wave
  • Gartley
  • Pitchfork
  • Fibonacci Projection

Line and Ray have their own separate parameter, which also needs to be set in the same way, if this option is desired: CIQ.Drawing.line.prototype.dragToDraw=true;

This parameter may be set for all drawings compatible with it, for a specific drawing type, or for a specific drawing instance. See examples.

Type:
  • boolean
Inherited From:
Overrides:
Example
// set drawing instance to dragToDraw. Only this one drawing will be affected
drawing.dragToDraw=true;
// Set particular drawing prototype to dragToDraw. All drawings to type "difference" will be affected
CIQ.Drawing["difference"].prototype.dragToDraw=true;
// Set all drawings to dragToDraw
CIQ.Drawing.prototype.dragToDraw=true;

permanent :boolean

Set this to true to disable selection, repositioning, and deletion by the end user.

This parameter may be set for all drawings, for a specific drawing type, or for a specific drawing instance. See examples.

Type:
  • boolean
Inherited From:
Overrides:
Example
// set drawing instance to permanent. Only this one drawing will be affected
drawing.permanent=true;
// Set particular drawing prototype to permanent. All drawings to type "difference" will be affected
CIQ.Drawing["difference"].prototype.permanent=true;
// Set all drawings to permanent
CIQ.Drawing.prototype.permanent=true;

Methods


abort(forceClear)

This function is called to tell a drawing to abort itself. It should clean up any rendered objects such as DOM elements or toggle states. It does not need to clean up anything that it drew on the canvas.

Parameters:
Name Type Description
forceClear boolean

Indicates that the user explicitly deleted the drawing (advanced usage).

Inherited From:
Overrides:

adjust()

Resets the points of the drawing when the periodicity changes or the underlying ticks change (either from pagination or from moving the points).

Since:
  • 7.4.0

Overrides:

boxToPixels(stx, panelName, box [, yAxis])

Converts a box represented by two corner coordinates [tick0,value0] and [tick1,value1] into pixel coordinates. This is important for drawing tools or any other device that requires the actual underlying price. This function is preferred over CIQ.convertBoxToPixels when used by drawing functions because it automatically returns the pixel values based off the values of the box as if they were values of the plot corresponding to the drawing's field property. CIQ.convertBoxToPixels usually returns the pixel values of the box assuming those values are the main series plot's values.

Parameters:
Name Type Argument Description
stx CIQ.ChartEngine

The chartEngine

panelName string

Panel on which the coordinates reside

box object

Box to convert

Properties
Name Type Argument Description
x0 number <optional>
y0 number <optional>
x1 number <optional>
y1 number <optional>
yAxis CIQ.ChartEngine.YAxis <optional>
Since:
  • 8.4.0

Inherited From:
Overrides:
Returns:

A converted box

Type
object

calculateRadius(context)

Calculates the width of the text enclosed in the annotation decorations. Iterates through the annotation points of the wave, measures the text of each annotation, and sets CIQ.Drawing.elliottwave.enclosedRadius to the width of the largest measurement.

If you would like to customize the radius, override this function with another that sets the value of enclosedRadius.

Parameters:
Name Type Description
context external:CanvasRenderingContext2D

The rendering context, which does the calculations.

Since:
  • 7.4.0


check(tick, value, pt)

Ensures that each successive data point is positioned correctly in the Elliott Wave progression. Called by CIQ.ChartEngine#drawingClick.

Parameters:
Name Type Description
tick Number

The tick where the wave data point is to be positioned.

value Number

The value (price) indicated by the tick where the wave data point is to be positioned.

pt Number

Represents whether the previous line was a gain or loss wave. If equal to 1, represents the first segment of the wave, which always results in a return value of true.

Since:
  • 7.4.0

Returns:

Indicates whether the current wave data point has been positioned correctly.

Type
Boolean

click(context, tick, value)

Responds to click events on the drawing.

Parameters:
Name Type Description
context external:CanvasRenderingContext2D

Canvas context in which to render the drawing.

tick Number

The tick where the click occurred.

value Number

The value where the click occurred.

Since:
  • 7.4.0

Overrides:
Returns:

True if the drawing is complete. Otherwise the kernel continues accepting clicks.

Type
boolean

construct(stx, panel)

Initializes the drawing. Assigns the waveParameters object of CIQ.ChartEngine#currentVectorParameters to the current drawing instance.

Parameters:
Name Type Description
stx CIQ.ChartEngine

A reference to the chart engine.

panel CIQ.ChartEngine.Panel

The panel that contains the drawing.

Since:
  • 7.4.0

Overrides:

copyConfig(withPreferences)

Instance function used to copy the relevant drawing parameters into itself. It just calls the static function.

Parameters:
Name Type Description
withPreferences boolean

set to true to return previously saved preferences

Since:
  • 3.0.0

Inherited From:
Overrides:

getLineColor(color [, ignoreHighlight])

Compute the proper color to use when rendering lines in the drawing.

Will use the color but if set to auto or transparent, will use the container's defaultColor. However, if color is set to auto and the drawing is based off a series or study plot, this function will return that plot's color. If drawing is highlighted will use the highlight color as defined in stx_highlight_vector style.

Parameters:
Name Type Argument Description
color string

Color string to check and use as a basis for setting. If not supplied, uses this.color.

ignoreHighlight boolean <optional>

True to ignore highlighting status when determining color (for example, if a label, or if determining fill color).

Since:
  • 7.0.0 Replaces setLineColor. Will return source line's color if auto.
  • 8.4.0 Added isLabel parameter.
  • 9.1.2 Changed name of isLabel parameter to ignoreHighlight.
Inherited From:
Overrides:
Returns:

Color to use for the line drawing

Type
string
Example
var trendLineColor=this.getLineColor();
		this.stx.plotLine(x0, x1, y0, y1, trendLineColor, "segment", context, panel, parameters);

highlight(highlighted)

Returns the highlighted state. Set this.highlighted to the highlight state. For simple drawings the highlighted state is just true or false. For complex drawings with pivot points for instance, the highlighted state may have more than two states. Whenever the highlighted state changes a draw() event will be triggered.

Parameters:
Name Type Description
highlighted Boolean

True to highlight the drawing, false to unhighlight

Inherited From:
Overrides:

intersected(tick, value, box)

Detects when the wave drawing has been intersected at either a point or the segments of the wave.

Parameters:
Name Type Description
tick Number

The tick under the mouse cursor.

value Number

The value under the mouse cursor.

box Object

A rectangular area around the mouse cursor.

Since:
  • 7.4.0

Overrides:
Returns:

An object that contains information about the intersection. This object is passed back to CIQ.Drawing.reposition when repositioning the drawing. Return false or null if not intersected. Simply returning true highlights the drawing.

Type
object

isAllowed(stx [, field])

Decides if a drawing can be created on the specified field.

Parameters:
Name Type Argument Description
stx CIQ.ChartEngine

The chart object.

field string <optional>

Field in the dataset, if something other than default.

Since:
  • 8.6.0

Inherited From:
Overrides:
Returns:

Whether a drawing can be made on the field.

Type
boolean

measure()

Displays the following:

  • The value at the last point in the drawing or at the drawing cursor position minus the value at the original wave point
  • The percentage change: (value at the last point or drawing cursor position - the value at the original wave point) / value at the original wave point
  • Number of data points included in the wave drawing
Since:
  • 7.4.0

Overrides:

move(context, tick, value)

Renders the movement when the user moves the drawing.

Parameters:
Name Type Description
context external:CanvasRenderingContext2D

The canvas context in which to render the moving drawing.

tick Number

The tick to which the drawing is being moved.

value Number

The value to which the drawing is being moved.

Since:
  • 7.4.0

Overrides:

pixelFromValue(panel, tick, value [, yAxis])

Returns the Y pixel location for the (split) unadjusted price rather than the displayed price for a drawing. This is important for drawing tools or any other device that requires the actual underlying price. This function is preferred over CIQ.ChartEngine#pixelFromValueAdjusted when used by drawing functions because it automatically returns the pixel based off the value of the plot corresponding the drawing's field property. CIQ.ChartEngine#pixelFromValueAdjusted usually returns the pixel of the main series plot's value.

Parameters:
Name Type Argument Description
panel CIQ.ChartEngine.Panel

The panel to get the value from

tick number

The tick location (in the dataSet) to check for an adjusted value

value number

The value

yAxis CIQ.ChartEngine.YAxis <optional>

The yaxis to use

Since:
  • 8.4.0

Inherited From:
Overrides:
Returns:

The pixel location of the plot whose field matches the field property of the drawing

Type
number

pointIntersection(tick, value, box, isPixels)

Returns true if the tick and value are inside the box

Parameters:
Name Type Description
tick number

The tick

value number

The value

box object

The box

isPixels boolean

True if tick and value are in pixels; otherwise, they assumed to be in ticks and untransformed y-axis values, respectively

Since:
  • 7.0.0 Added isPixels.

Inherited From:
Overrides:
Returns:

True if the tick and value are within the box

Type
boolean

reconstruct(stx, obj)

Reconstructs the drawing from an object returned from CIQ.Drawing.elliottwave#serialize.

Parameters:
Name Type Description
stx CIQ.ChartEngine

A reference to the chart engine.

obj object

The object that contains the serialized drawing.

Since:
  • 9.0.0 Added prm and hdn property to obj parameter.

Overrides:

render(context)

Renders the wave on the chart.

Parameters:
Name Type Description
context external:CanvasRenderingContext2D

The context in which the drawing is rendered.

Since:
  • 7.4.0

Overrides:

reposition(context, repositioner, tick, value)

Repositions the drawing on drag (user moves an individual point of the drawing) or move (user moves the whole drawing) interactions.

Parameters:
Name Type Description
context external:CanvasRenderingContext2D

The canvas context on which to render the drawing.

repositioner Object

The object containing data on how to reposition the drawing.

tick Number

The tick to which the drawing is repositioned.

value Number

The value to which the drawing is repositioned.

Since:
  • 7.4.0

Overrides:

serialize()

Serializes the drawing to an object that can be restored with CIQ.Drawing.elliottwave#reconstruct. To store a drawing, convert the object returned by this function to a JSON string.

Since:
  • 9.0.0 Added prm and hdn property to obj parameter.

Overrides:
Returns:

An object that contains the serialized state of the drawing.

Type
object

setLineColor()

Compute the proper color to use when rendering lines in the drawing.

Since:
  • 4.0.0
  • 7.0.0 Deprecated
Inherited From:
Overrides:
Deprecated:

setPoint(point, x, y [, chart])

Sets the internal properties of the drawing points where x is a tick or a date and y is a value.

Parameters:
Name Type Argument Description
point number

index to point to be converted (0,1)

x number | string

index of bar in dataSet (tick) or date of tick (string form)

y number

price

chart CIQ.ChartEngine.Chart <optional>

Optional chart object

Since:
  • 04-2015
  • 8.3.0 x tick values outside an allowable range will be replaced by values at the edge of the range. This is to prevent performance problems when switching periodicities.
Inherited From:
Overrides:

valueFromPixel(pixel [, panel] [, yAxis])

Returns the value (price) of a drawing given a y-axispixel. The value is relative to the panel or the canvas. This function is preferred over CIQ.ChartEngine#valueFromPixel when used by drawing functions because it automatically returns the value based off the plot corresponding the drawing's field property. CIQ.ChartEngine#valueFromPixel usually returns the value of the main series plot.

Parameters:
Name Type Argument Description
pixel number

The y pixel position

panel CIQ.ChartEngine.Panel <optional>

A panel object. If passed then the value will be relative to that panel. If not passed then the value will be relative to the panel that is in the actual Y location.

yAxis CIQ.ChartEngine.YAxis <optional>

Which yAxis. Defaults to panel.yAxis.

Since:
  • 8.4.0

Inherited From:
Overrides:
Returns:

The value relative to the panel, of the plot whose field matches the field property of the drawing

Type
number