new elliottwave()
Creates the Elliott Wave drawing tool.
- Since:
-
7.4.0
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 |
Methods
-
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
-
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
-
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
-
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
-
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
-
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
-
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
andhdn
property toobj
parameter.
-
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
-
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
-
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
andhdn
property toobj
parameter.
Returns:
An object that contains the serialized state of the drawing.
- Type
- object