Cbot access the trendlines drawn on the chart
Cbot access the trendlines drawn on the chart
30 Aug 2024, 19:56
Hi All,
Im trying to write a cbot, where im drawing the chart objects (like trendline) mannually on the chart, i want the algorithm to read it. Im using the below logic -
foreach (var chartObject in Chart.Objects)
{
Print(chartObject.Name);
}
But in the console i see the Names as -
is there any way i could give a proper name on the chart-trendline while drawing?I dont see anywhere i can give names. or i can read comments on the algorithm?
thanks
Replies
keerthankumarkateel
01 Sep 2024, 06:16
RE: Cbot access the trendlines drawn on the chart
PanagiotisCharalampous said:
Hi there,
Unfortunately there is no way to set names for lines manually drawn on the chart.
Best regards,
Panagiotis
Hello,
Thank you for responding. If i want to create an algo with two mannually drawn trendlines (line-A and line-B). Logic is if the price crossed below Line-A buy the ticker and if the price touches the Line-B close the position.
Is this possible to implement? this needs algo to read the mannuaaly drawn trendline, identify it and calculate the price based on the line. Point me if there are any examples/documentation on this on how to implement this.
@keerthankumarkateel
PanagiotisCharalampous
02 Sep 2024, 05:41
RE: RE: Cbot access the trendlines drawn on the chart
keerthankumarkateel said:
PanagiotisCharalampous said:
Hi there,
Unfortunately there is no way to set names for lines manually drawn on the chart.
Best regards,
Panagiotis
Hello,
Thank you for responding. If i want to create an algo with two mannually drawn trendlines (line-A and line-B). Logic is if the price crossed below Line-A buy the ticker and if the price touches the Line-B close the position.
Is this possible to implement? this needs algo to read the mannuaaly drawn trendline, identify it and calculate the price based on the line. Point me if there are any examples/documentation on this on how to implement this.
Hi there,
Yes it is possible to do this but there is no specific documentation for this since this is rudimentary algebra and not a cTrader specific issue. A trendline's equation is ax+b, you need to use it to find the value of the trendline on each bar and determine if the price has crossed it or not.
Best regards,
Panagiotis
@PanagiotisCharalampous
keerthankumarkateel
02 Sep 2024, 07:03
RE: RE: RE: Cbot access the trendlines drawn on the chart
PanagiotisCharalampous said:
keerthankumarkateel said:
PanagiotisCharalampous said:
Hi there,
Unfortunately there is no way to set names for lines manually drawn on the chart.
Best regards,
Panagiotis
Hello,
Thank you for responding. If i want to create an algo with two mannually drawn trendlines (line-A and line-B). Logic is if the price crossed below Line-A buy the ticker and if the price touches the Line-B close the position.
Is this possible to implement? this needs algo to read the mannuaaly drawn trendline, identify it and calculate the price based on the line. Point me if there are any examples/documentation on this on how to implement this.
Hi there,
Yes it is possible to do this but there is no specific documentation for this since this is rudimentary algebra and not a cTrader specific issue. A trendline's equation is ax+b, you need to use it to find the value of the trendline on each bar and determine if the price has crossed it or not.
Best regards,
Panagiotis
if im drawing the line on the chart mannually, how i can get values of a,x,b in the algo?
@keerthankumarkateel
keerthankumarkateel
02 Sep 2024, 07:04
RE: RE: RE: RE: Cbot access the trendlines drawn on the chart
keerthankumarkateel said:
PanagiotisCharalampous said:
keerthankumarkateel said:
PanagiotisCharalampous said:
Hi there,
Unfortunately there is no way to set names for lines manually drawn on the chart.
Best regards,
Panagiotis
Hello,
Thank you for responding. If i want to create an algo with two mannually drawn trendlines (line-A and line-B). Logic is if the price crossed below Line-A buy the ticker and if the price touches the Line-B close the position.
Is this possible to implement? this needs algo to read the mannuaaly drawn trendline, identify it and calculate the price based on the line. Point me if there are any examples/documentation on this on how to implement this.
Hi there,
Yes it is possible to do this but there is no specific documentation for this since this is rudimentary algebra and not a cTrader specific issue. A trendline's equation is ax+b, you need to use it to find the value of the trendline on each bar and determine if the price has crossed it or not.
Best regards,
Panagiotis
if im drawing the line on the chart mannually (NOT via algo),
- how i can get values of a,x,b in the algo for that line?
- If i draw multiple lines on the chart (mannually), how can distinguish between the lines? As i can see when i draw a line on the chart, i cant name the line
@keerthankumarkateel
PanagiotisCharalampous
02 Sep 2024, 08:12
RE: RE: RE: RE: RE: Cbot access the trendlines drawn on the chart
keerthankumarkateel said:
keerthankumarkateel said:
PanagiotisCharalampous said:
keerthankumarkateel said:
PanagiotisCharalampous said:
Hi there,
Unfortunately there is no way to set names for lines manually drawn on the chart.
Best regards,
Panagiotis
Hello,
Thank you for responding. If i want to create an algo with two mannually drawn trendlines (line-A and line-B). Logic is if the price crossed below Line-A buy the ticker and if the price touches the Line-B close the position.
Is this possible to implement? this needs algo to read the mannuaaly drawn trendline, identify it and calculate the price based on the line. Point me if there are any examples/documentation on this on how to implement this.
Hi there,
Yes it is possible to do this but there is no specific documentation for this since this is rudimentary algebra and not a cTrader specific issue. A trendline's equation is ax+b, you need to use it to find the value of the trendline on each bar and determine if the price has crossed it or not.
Best regards,
Panagiotis
if im drawing the line on the chart mannually (NOT via algo),
- how i can get values of a,x,b in the algo for that line?
- If i draw multiple lines on the chart (mannually), how can distinguish between the lines? As i can see when i draw a line on the chart, i cant name the line
Hi there,
- ChartTrendLine has Time1, Time1, Y1(start price) and Y2(end price) properties. You can use them to calculate a,x and b.
- There is no easy way to do this. Names for the lines are assigned automatically by cTrader.
@PanagiotisCharalampous
keerthankumarkateel
02 Sep 2024, 08:17
RE: RE: RE: RE: RE: RE: Cbot access the trendlines drawn on the chart
PanagiotisCharalampous said:
keerthankumarkateel said:
keerthankumarkateel said:
PanagiotisCharalampous said:
keerthankumarkateel said:
PanagiotisCharalampous said:
Hi there,
Unfortunately there is no way to set names for lines manually drawn on the chart.
Best regards,
Panagiotis
Hello,
Thank you for responding. If i want to create an algo with two mannually drawn trendlines (line-A and line-B). Logic is if the price crossed below Line-A buy the ticker and if the price touches the Line-B close the position.
Is this possible to implement? this needs algo to read the mannuaaly drawn trendline, identify it and calculate the price based on the line. Point me if there are any examples/documentation on this on how to implement this.
Hi there,
Yes it is possible to do this but there is no specific documentation for this since this is rudimentary algebra and not a cTrader specific issue. A trendline's equation is ax+b, you need to use it to find the value of the trendline on each bar and determine if the price has crossed it or not.
Best regards,
Panagiotis
if im drawing the line on the chart mannually (NOT via algo),
- how i can get values of a,x,b in the algo for that line?
- If i draw multiple lines on the chart (mannually), how can distinguish between the lines? As i can see when i draw a line on the chart, i cant name the line
Hi there,
- ChartTrendLine has Time1, Time1, Y1(start price) and Y2(end price) properties. You can use them to calculate a,x and b.
- There is no easy way to do this. Names for the lines are assigned automatically by cTrader.
thanks a lot for response.
- are there any examples of the code or documentation about - how to extract information from the trendline on the chart via code. If yes, please pont me.
@keerthankumarkateel
PanagiotisCharalampous
01 Sep 2024, 05:16
Hi there,
Unfortunately there is no way to set names for lines manually drawn on the chart.
Best regards,
Panagiotis
@PanagiotisCharalampous