Problem with drawing lines
29 Jan 2018, 10:34
Hello. How to draw vertical lines on a chart in a bot? I watched the examples but there only for the indicators.
Replies
mishavas15@gmail.com
29 Jan 2018, 17:21
( Updated at: 21 Dec 2023, 09:20 )
Yes. I'm using this function. But the lines are not displayed on the graph. Here is the code for the example:
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class TestBot : Robot
{
protected override void OnBar()
{
DateTime time = GetCurrentTime();
string id = "line " + time;
ChartObjects.DrawVerticalLine(id, time, Colors.Red);
Print(id);
}
private DateTime GetCurrentTime()
{
return MarketSeries.OpenTime.LastValue;
}
}
Result:

@mishavas15@gmail.com
PanagiotisCharalampous
29 Jan 2018, 17:27
Hi mishavas15@gmail.com,
From what I can see you are in the backtesting section. Lines are not drawn in the backtesting chart. Try to run the cBot on an actual chart.
Best Regards,
Panagiotis
@PanagiotisCharalampous
mishavas15@gmail.com
29 Jan 2018, 17:36
Yes. For the actual chart works. Is there is a way of displayend lines in the backtest using bot?
@mishavas15@gmail.com
PanagiotisCharalampous
29 Jan 2018, 17:56
Hi,
Currently there is no way to do this but this feature will be available in a future release of cTrader.
Best Regards,
Panagiotis
@PanagiotisCharalampous

PanagiotisCharalampous
29 Jan 2018, 15:44
Dear Trader,
Thanks for posting in our forum. You can use the DrawVerticalLine function.
Let me know if this information is helpful.
Best Regards,
Panagiotis
@PanagiotisCharalampous