Draw Lines @ axis
-
I am attempting to draw lines on the chart based X and Y coordinates, in an attempt to put trend lines on my chart, to represent visual zones of time. I dont want to use price points because if the price point moves off screen, I want the lines to follow the time. Only way I can see that happening, is by constantly updating the point that they are printed on the X and Y axis, but I dont understand how to do it.
-
You can use this,
ChartXYToTimePrice(
long chart_id, // Chart ID
int x, // The X coordinate on the chart
int y, // The Y coordinate on the chart
int& sub_window, // The number of the subwindow
datetime& time, // Time on the chart
double& price // Price on the chart
);
in custom code, save into a variable, redraw line using variable, X & Y will stay the same but lines should move with time/price. -
@TipsyWisdom you mean something like the period separator lines?

-

like these. but these are price anchored. I want Y axis for where to put the lines, not price.
-
the colored lines @ the top
-
So you want a fixed Y point but moving X coordinate? Or both fixed - then you could use "rectangle label" object.
-
@roar said in Draw Lines @ axis:
So you want a fixed Y point but moving X coordinate? Or both fixed - then you could use "rectangle label" object.
yea, for X coordinates, I would like to use my time stamp since I seek time first, but for the Y coordinate, I'd like to the bars of color to just to displayed visually at the top of the chart as high as I can get them.
-
@jstap said in Draw Lines @ axis:
You can use this,
ChartXYToTimePrice(
long chart_id, // Chart ID
int x, // The X coordinate on the chart
int y, // The Y coordinate on the chart
int& sub_window, // The number of the subwindow
datetime& time, // Time on the chart
double& price // Price on the chart
);
in custom code, save into a variable, redraw line using variable, X & Y will stay the same but lines should move with time/price.almost would work, but I want to time as one of the axis
-
perhaps a more detailed purpose would help...
I am trying to mark zones of time that I am allowed to trade within, by placing a small colored line across the top of the chart to represent that frame of time I can trade within. There are several zones I need to show that should all be horizontally across the same plane.
Chart moves up, chart moves down, shouldnt matter. the lines should stay where they sit horizontally OnChart.
-
Horizontal is price, vertical is time, explain more what you mean?
-
I think what's needed is x value as a datetime, y value as a pixel coordinate. A mix between label-type object and normal object.
So one option is to use rectangle label (fixed pixel coordinates) and continually update the x value with ChartTimePriceToXY function (ignore the Price->Y conversion in that function).