Drawing
Drawing functions are mostly used for painting drawings and accessing drawing script instances. Using these functions during backtesting or optimization might significantly slow the platform down and is not recommended.
Read more: Drawing Scripts
Sections
Name |
Description |
Gets the bar of a specified anchor point. 0 being the latest bar, 1 is the bar preceding it, etc. |
|
Gets the number of anchor points that have already been set for the drawing. |
|
Determines whether a specified anchor point exists, i.e. the anchor point has been set. |
|
Gets the y-axis value of a specified anchor point. |
|
Clears the drawing from everything other than its anchor points. |
|
Initializes the drawing with the symbol on which it is drawn and with the number of required anchor points. Note that this function must be called in the OnInitialize of the drawing. |
|
Determines whether the drawing is ready to be drawn. |
|
Gets the maximum bar shift of any of the points set thus far (excluding anchor points). |
|
Gets the maximum y-axis value of any of the points set thus far in the specified drawing (excluding anchor points). |
|
Gets the minimum bar shift of any of the points set thus far (excluding anchor points). |
|
Gets the minimum y-axis value of any of the points set thus far (excluding anchor points). |
|
Gets the bar of a specified anchor point of a specified drawing. 0 being the latest bar, 1 is the bar preceding it, etc. |
|
Gets the number of anchor points that have already been set for a specified drawing. |
|
Determines whether a specified anchor point exists, i.e. the anchor point has been set, for a specified drawing. |
|
Gets the y-axis value of a specified anchor point of a specified drawing. |
|
Clears a specified drawing from everything other than its anchor points. |
|
Creates the drawing on a virtual canvas to allow access to the drawing values. Anchor points for the drawing must be preset. (To display the drawing on a chart, see the ChartDrawingPlot function) |
|
Determines whether the drawing is ready to be drawn. |
|
Gets the maximum bar shift of any of the points set thus far in a specified drawing (excluding anchor points). |
|
Gets the maximum y-axis value of any of the points set thus far in a specified drawing (excluding anchor points). |
|
Gets the minimum bar shift of any of the points set thus far in a specified drawing (excluding anchor points). |
|
Gets the minimum y-axis value of any of the points set thus far in a specified drawing (excluding anchor points). |
|
Gets the labels of the points currently set at a specified bar in a specified drawing (excluding anchor points). |
|
Gets the y-axis values of the points currently set at a specified bar in a specified drawing (excluding anchor points). |
|
Removes a specified drawing so that it no longer takes up memory. |
|
Gets the number of anchor points required for a specified drawing. |
|
Sets a specified anchor point in a specified drawing. |
|
Sets a specified anchor point in a specified drawing while snapping its value (y-axis) to the bar close. |
|
Sets a specified anchor point in a specified drawing while snapping its value (y-axis) to the bar high. |
|
Sets a specified anchor point in a specified drawing while snapping its value (y-axis) to the bar low. |
|
Sets a specified anchor point in a specified drawing while snapping its value (y-axis) to the bar open. |
|
Gets the underlying symbol index of a specified drawing. |
|
Determines whether the drawing has points at a specified bar. |
|
Gets the labels of the points currently set at a specified bar (excluding anchor points). |
|
Gets the y-axis values of the points currently set at a specified bar (excluding anchor points). |
|
Registers a pen in the OnChartSetup function in order to allow the use of the pen by the drawing. |
|
Registers a pen in the OnChartSetup function in order to allow the use of the pen by the drawing. |
|
Gets the number of required anchor points. |
|
Sets a specified anchor point in the drawing. |
|
Sets a specified anchor point in the drawing while snapping its value (y-axis) to the bar close. |
|
Sets a specified anchor point in the drawing while snapping its value (y-axis) to the bar high. |
|
Sets a specified anchor point in the drawing while snapping its value (y-axis) to the bar low. |
|
Sets a specified anchor point in the drawing while snapping its value (y-axis) to the bar open. |
|
DrawingSetEllipse(string, string, int, double, int, double, string) |
Draws an ellipse drawing. |
Draws an extended line between two specified points. |
|
Displays a specified image at a specified point. |
|
DrawingSetLine(string, int, double, string, int, double, string) |
Draws a line between two specified points. |
DrawingSetPolygon(string, string, int[], double[], string[]) |
Draws a polygon on the chart. |
Draws a ray between two specified points. |
|
Copies a specified drawing from the OnInitialize parameters and assign it a symbol, as the parameters do not have an underlying symbol assigned to them. |
|
Draws an editable rectangular text label. |
int DrawingAnchorPointBarShift(int anchorPointIndex) |
||||||
Gets the bar of a specified anchor point. 0 being the latest bar, 1 is the bar preceding it, etc. Returns The bar of the specified anchor point. 0 being the latest bar, 1 is the bar preceding it, etc. Parameters
Scripts Drawing |
int DrawingAnchorPointCount() |
Gets the number of anchor points that have already been set for the drawing. Returns The number of anchor points that have already been set for the drawing. Scripts Drawing |
bool DrawingAnchorPointExists(int anchorPointIndex) |
||||||
Determines whether a specified anchor point exists, i.e. the anchor point has been set. Returns True if the specified anchor point exists, false otherwise. Parameters
Scripts Drawing |
double DrawingAnchorPointValue(int anchorPointIndex) |
||||||
Gets the y-axis value of a specified anchor point. Returns The y-axis value of the specified anchor point. Parameters
Scripts Drawing |
DrawingClear() |
Clears the drawing from everything other than its anchor points. Scripts Drawing |
DrawingInitialize(int symbolIndex, int requiredAnchorPoints) |
|||||||||
Initializes the drawing with the symbol on which it is drawn and with the number of required anchor points. Note that this function must be called in the OnInitialize of the drawing. Parameters
Scripts Drawing |
bool DrawingIsReady() |
Determines whether the drawing is ready to be drawn. Returns True if the drawing has all the anchor points set, false otherwise. Scripts Drawing |
int DrawingMaxBarShift() |
Gets the maximum bar shift of any of the points set thus far (excluding anchor points). Returns The maximum bar shift of any of the points set thus far. Scripts Drawing |
double DrawingMaxValue() |
Gets the maximum y-axis value of any of the points set thus far in the specified drawing (excluding anchor points). Returns The maximum y-axis value of any of the points set thus far. Scripts Drawing |
int DrawingMinBarShift() |
Gets the minimum bar shift of any of the points set thus far (excluding anchor points). Returns The minimum bar shift of any of the points set thus far. Scripts Drawing |
double DrawingMinValue() |
Gets the minimum y-axis value of any of the points set thus far (excluding anchor points). Returns The minimum y-axis value of any of the points set thus far. Scripts Drawing |
int DrawingObjectAnchorPointBarShift(Drawing drawing, int anchorPointIndex) |
|||||||||
Gets the bar of a specified anchor point of a specified drawing. 0 being the latest bar, 1 is the bar preceding it, etc. Returns The bar of the specified anchor point. 0 being the latest bar, 1 is the bar preceding it, etc. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
int DrawingObjectAnchorPointCount(Drawing drawing) |
||||||
Gets the number of anchor points that have already been set for a specified drawing. Returns The number of anchor points that have already been set for the specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
bool DrawingObjectAnchorPointExists(Drawing drawing, int anchorPointIndex) |
|||||||||
Determines whether a specified anchor point exists, i.e. the anchor point has been set, for a specified drawing. Returns True if the specified anchor point exists, false otherwise. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
double DrawingObjectAnchorPointValue(Drawing drawing, int anchorPointIndex) |
|||||||||
Gets the y-axis value of a specified anchor point of a specified drawing. Returns The y-axis value of the specified anchor point. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
DrawingObjectClear(Drawing drawing) |
||||||
Clears a specified drawing from everything other than its anchor points. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
DrawingObjectCreate(Drawing drawing) |
||||||
Creates the drawing on a virtual canvas to allow access to the drawing values. Anchor points for the drawing must be preset. (To display the drawing on a chart, see the ChartDrawingPlot function) Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
bool DrawingObjectIsReady(Drawing drawing) |
||||||
Determines whether the drawing is ready to be drawn. Returns True if the drawing has all the anchor points set, false otherwise. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
int DrawingObjectMaxBarShift(Drawing drawing) |
||||||
Gets the maximum bar shift of any of the points set thus far in a specified drawing (excluding anchor points). Returns The maximum bar shift of any of the points set thus far in the specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
double DrawingObjectMaxValue(Drawing drawing) |
||||||
Gets the maximum y-axis value of any of the points set thus far in a specified drawing (excluding anchor points). Returns The maximum y-axis value of any of the points set thus far in the specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
int DrawingObjectMinBarShift(Drawing drawing) |
||||||
Gets the minimum bar shift of any of the points set thus far in a specified drawing (excluding anchor points). Returns The minimum bar shift of any of the points set thus far in the specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
double DrawingObjectMinValue(Drawing drawing) |
||||||
Gets the minimum y-axis value of any of the points set thus far in a specified drawing (excluding anchor points). Returns The minimum y-axis value of any of the points set thus far in the specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
string[] DrawingObjectPointLabels(Drawing drawing, int barShift) |
|||||||||
Gets the labels of the points currently set at a specified bar in a specified drawing (excluding anchor points). Returns The point labels currently set at the specified bar in the specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
double[] DrawingObjectPointValues(Drawing drawing, int barShift) |
|||||||||
Gets the y-axis values of the points currently set at a specified bar in a specified drawing (excluding anchor points). Returns The y-axis values of the points currently set at a specified bar in the specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
DrawingObjectRemove(Drawing drawing) |
||||||
Removes a specified drawing so that it no longer takes up memory. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
int DrawingObjectRequiredAnchorPoints(Drawing drawing) |
||||||
Gets the number of anchor points required for a specified drawing. Returns The number of anchor points required for the specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
DrawingObjectSetAnchorPoint(Drawing drawing, int anchorPointIndex, int barShift, double value) |
|||||||||||||||
Sets a specified anchor point in a specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
DrawingObjectSetAnchorPointClose(Drawing drawing, int anchorPointIndex, int barShift) |
||||||||||||
Sets a specified anchor point in a specified drawing while snapping its value (y-axis) to the bar close. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
DrawingObjectSetAnchorPointHigh(Drawing drawing, int anchorPointIndex, int barShift) |
||||||||||||
Sets a specified anchor point in a specified drawing while snapping its value (y-axis) to the bar high. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
DrawingObjectSetAnchorPointLow(Drawing drawing, int anchorPointIndex, int barShift) |
||||||||||||
Sets a specified anchor point in a specified drawing while snapping its value (y-axis) to the bar low. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
DrawingObjectSetAnchorPointOpen(Drawing drawing, int anchorPointIndex, int barShift) |
||||||||||||
Sets a specified anchor point in a specified drawing while snapping its value (y-axis) to the bar open. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
int DrawingObjectSymbolIndex(Drawing drawing) |
||||||
Gets the underlying symbol index of a specified drawing. Returns The underlying symbol index of the specified drawing. Parameters
Scripts TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy |
bool DrawingPointExists(int barShift) |
||||||
Determines whether the drawing has points at a specified bar. Returns True if the drawing has points at the specified bar, false otherwise. Parameters
Scripts Drawing |
string[] DrawingPointLabels(int barShift) |
||||||
Gets the labels of the points currently set at a specified bar (excluding anchor points). Returns The point labels currently set at the specified bar. Parameters
Scripts Drawing |
double[] DrawingPointValues(int barShift) |
||||||
Gets the y-axis values of the points currently set at a specified bar (excluding anchor points). Returns The point y-axis values currently set at the specified bar. Parameters
Scripts Drawing |
DrawingRegisterPen(string penName, C_Color color, C_DashStyle dashStyle, int thickness) |
|||||||||||||||
Registers a pen in the OnChartSetup function in order to allow the use of the pen by the drawing. Parameters
Scripts Drawing |
DrawingRegisterPen(string penName, int[] color, C_DashStyle dashStyle, int thickness) |
|||||||||||||||
Registers a pen in the OnChartSetup function in order to allow the use of the pen by the drawing. Parameters
Scripts Drawing |
int DrawingRequiredAnchorPoints() |
Gets the number of required anchor points. Returns The number of required anchor points. Scripts Drawing |
DrawingSetAnchorPoint(int anchorPointIndex, int barShift, double value) |
||||||||||||
Sets a specified anchor point in the drawing. Parameters
Scripts Drawing |
DrawingSetAnchorPointClose(int anchorPointIndex, int barShift) |
|||||||||
Sets a specified anchor point in the drawing while snapping its value (y-axis) to the bar close. Parameters
Scripts Drawing |
DrawingSetAnchorPointHigh(int anchorPointIndex, int barShift) |
|||||||||
Sets a specified anchor point in the drawing while snapping its value (y-axis) to the bar high. Parameters
Scripts Drawing |
DrawingSetAnchorPointLow(int anchorPointIndex, int barShift) |
|||||||||
Sets a specified anchor point in the drawing while snapping its value (y-axis) to the bar low. Parameters
Scripts Drawing |
DrawingSetAnchorPointOpen(int anchorPointIndex, int barShift) |
|||||||||
Sets a specified anchor point in the drawing while snapping its value (y-axis) to the bar open. Parameters
Scripts Drawing |
DrawingSetEllipse(string strokePenName, string fillPenName, int x, double y, int radiusX, double radiusY, string label) |
||||||||||||||||||||||||
Draws an ellipse drawing. Parameters
Scripts Drawing |
DrawingSetExtendedLine(string penName, int x1, double y1, int x2, double y2) |
||||||||||||||||||
Draws an extended line between two specified points. Parameters
Scripts Drawing |
DrawingSetImage(string imagePath, int x, double y) |
||||||||||||
Displays a specified image at a specified point. Parameters
Scripts Drawing |
DrawingSetLine(string penName, int x1, double y1, string label1, int x2, double y2, string label2) |
||||||||||||||||||||||||
Draws a line between two specified points. Parameters
Scripts Drawing |
DrawingSetPolygon(string strokePenName, string fillPenName, int[] x, double[] y, string[] label) |
||||||||||||||||||
Draws a polygon on the chart. Parameters
Scripts Drawing |
DrawingSetRay(string penName, int x1, double y1, int x2, double y2) |
||||||||||||||||||
Draws a ray between two specified points. Parameters
Scripts Drawing |
Drawing DrawingSetSymbol(Drawing drawing, int symbolIndex) |
|||||||||
Copies a specified drawing from the OnInitialize parameters and assign it a symbol, as the parameters do not have an underlying symbol assigned to them. Returns A copy of the specified drawing over the specified symbol. Parameters
Scripts MultiSymbolTradingStrategy |
DrawingSetText(string text, int x, double y, string strokePenName, string fillPenName) |
||||||||||||||||||
Draws an editable rectangular text label. Parameters
Scripts Drawing |