- Object types and features of specifying their coordinates
- Time and price bound objects
- Objects bound to screen coordinates
- Creating objects
- Deleting objects
- Finding objects
- Overview of object property access functions
- Main object properties
- Price and time coordinates
- Anchor window corner and screen coordinates
- Defining anchor point on the object
- Managing the object state
- Priority of objects (Z-Order)
- Object display settings: color, style, and frame
- Font settings
- Rotating text at an arbitrary angle
- Determining object width and height
- Visibility of objects in the context of timeframes
- Assigning a character code to a label
- Ray properties for objects with straight lines
- Managing object pressed state
- Adjusting images in bitmap objects
- Cropping (outputting part) of an image
- Input field properties: alignment and read-only
- Standard deviation channel width
- Setting levels in level objects
- Additional properties of Gann, Fibonacci, and Elliot objects
- Chart object
- Moving objects
- Getting time or price at the specified line points
Ray properties for objects with straight lines
Among graphical objects, there are several types in which the lines between anchor points can be displayed either as segments (i.e., strictly between a pair of points) or as endless straight lines continuing in one or another direction across the entire window visibility area. Such objects are:
- Trend line
- Trendline by angle
- All types of channels (equidistant, standard deviations, regression, Andrews pitchfork)
- Gann line
- Fibonacci lines
- Fibonacci channel
- Fibonacci expansion
For them, you can separately enable line continuation to the left or right using the OBJPROP_RAY_LEFT and OBJPROP_RAY_RIGHT properties, respectively. In addition, for a vertical line, you can specify whether it should be drawn in all chart subwindows or only in the current one (where the anchor point is located): the OBJPROP_RAY property is responsible for this. All properties are boolean, meaning they can be enabled (true) or disabled (false).
Identifier |
Description |
---|---|
OBJPROP_RAY_LEFT |
Ray continues to the left |
OBJPROP_RAY_RIGHT |
Ray continues to the right |
OBJPROP_RAY |
Vertical line extends to all chart windows |
You can check the operation of the rays using the ObjectRays.mq5 script. It creates 3 standard deviation channels with different ray settings.
One specific object is created and configured by the helper function SetupChannel. Through its parameters, the channel length in bars and the channel width (deviation) are set, as well as options for displaying rays to the left and right, and color.
#include "ObjectPrefix.mqh"
|
In the OnStart function, we call SetupChannel for 3 different channels.
void OnStart()
|
As a result, we get a chart of the following form.
Channels with different OBJPROP_RAY_LEFT and OBJPROP_RAY_RIGHT property settings
When rays are enabled, it becomes possible to request the object to extrapolate time and price values using the functions that we will describe in the Getting time or price at given points on lines section.