MQL4参考 图表操作 ChartTimePriceToXY

ChartTimePriceToXY

Converts the coordinates of a chart from the time/price representation to the X and Y coordinates.

bool  ChartTimePriceToXY(
   long           chart_id,     // Chart ID
   int            sub_window,   // The number of the subwindow
   datetime       time,         // Time on the chart
   double         price,        // Price on the chart
   int&           x,            // The X coordinate for the time on the chart
   int&           y             // The Y coordinates for the price on the chart
   );

Parameters

chart_id

[in]  Chart ID. 0 means the current chart.

sub_window

[in]  The number of the chart subwindow. 0 means the main chart window.

time

[in]  The time value on the chart, for which the value in pixels along the X axis will be received.

price

[in]   The price value on the chart, for which the value in pixels along the Y axis will be received.

x

[out]  The variable, into which the conversion of time to X will be received. The origin is in the upper left corner of the main chart window.

y

[out]  The variable, into which the conversion of price to Y will be received. The origin is in the upper left corner of the main chart window.

Return Value

Returns true if successful, otherwise false. To get information about the error, call the GetLastError() function.

See also

ChartXYToTimePrice()