Custom Indicator Values Controlled by cBot in cTrader

Created at 23 Jul 2024, 16:35
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CO

cortes.br

Joined 03.12.2023

Custom Indicator Values Controlled by cBot in cTrader
23 Jul 2024, 16:35


Hi everyone,

 

I'm currently working on a project where I need a custom indicator in cTrader whose values are controlled by a cBot. The idea is that the cBot will determine and set the indicator values during each OnBar event, and these values will then be plotted on the chart by the indicator.

The main goal is to plot on the chart the values that are calculated during the execution of the bot.

I've attempted to create the custom indicator and cBot, but it seems I'm missing something as it isn't functioning as expected.


@cortes.br
Replies

firemyst
24 Jul 2024, 02:50

Well, you haven't shown us anything you've done, so I'm not sure how much help you're expecting from people.

 

Note that you'll probably have to reinitialize the indicator on each onBar event for the indicator to take on the new values and historically calculate them. While it may not matter too much on a long time frame or higher non-time frame based chart (like renko 20 vs renko 5), it could end up being CPU intensive if done frequently like for every bar on a 1-minute chart.


@firemyst

PanagiotisCharalampous
24 Jul 2024, 06:45

Hi there,

The idea is that the cBot will determine and set the indicator values during each OnBar event, and these values will then be plotted on the chart by the indicator.

Can you please explain to us why this design is necessary?

Best regards,

Panagiotis


@PanagiotisCharalampous

cortes.br
24 Jul 2024, 11:46

I want to plot on the chart points that represent quantities calculated during the execution of the robot, such as limit and stop prices. I need the ability to draw values on the chart for debugging and visualization purposes. Specifically, I am looking for a function equivalent to PlotTimeSeries found in WealthLab.

 

 

PlotTimeSeries

public void PlotTimeSeries(TimeSeries ts, string name, string paneTag, WLColor color = default(WLColor), PlotStyles plotStyle = PlotStyle.Line, bool suppressLabels = false)

Plots a TimeSeries on the chart. The ts parameter is a TimeSeries instance. PlotTimeSeries is useful when plotting the results of mathematical operations on indicators and other TimeSeries. These operations always return instances of the TimeSeries class.

The name parameter should be a descriptive name of the data being plotted. This appears in the pane label.

The paneTag specifies which chart pane to plot the data in. You can specify Price for the price pane, Volume for the volume pane, or some other string value for a custom pane.

The color parameter is optional. If not provided, WealthLab will use a default color.

The plotStyle parameter is also optional, and is a member of the PlotStyle enum. If not specified, WealthLab will use PlotStyle.Line.

The suppressLabels parameter lets you disable to indicator pane labels and the value markers along the chart's right margin for this plot.


@cortes.br

PanagiotisCharalampous
25 Jul 2024, 05:34

RE: Custom Indicator Values Controlled by cBot in cTrader

cortes.br said: 

I want to plot on the chart points that represent quantities calculated during the execution of the robot, such as limit and stop prices. I need the ability to draw values on the chart for debugging and visualization purposes. Specifically, I am looking for a function equivalent to PlotTimeSeries found in WealthLab.

 

 

PlotTimeSeries

public void PlotTimeSeries(TimeSeries ts, string name, string paneTag, WLColor color = default(WLColor), PlotStyles plotStyle = PlotStyle.Line, bool suppressLabels = false)

Plots a TimeSeries on the chart. The ts parameter is a TimeSeries instance. PlotTimeSeries is useful when plotting the results of mathematical operations on indicators and other TimeSeries. These operations always return instances of the TimeSeries class.

The name parameter should be a descriptive name of the data being plotted. This appears in the pane label.

The paneTag specifies which chart pane to plot the data in. You can specify Price for the price pane, Volume for the volume pane, or some other string value for a custom pane.

The color parameter is optional. If not provided, WealthLab will use a default color.

The plotStyle parameter is also optional, and is a member of the PlotStyle enum. If not specified, WealthLab will use PlotStyle.Line.

The suppressLabels parameter lets you disable to indicator pane labels and the value markers along the chart's right margin for this plot.

Why don't you do all of this in an indicator?


@PanagiotisCharalampous

cortes.br
25 Jul 2024, 12:56

RE: RE: Custom Indicator Values Controlled by cBot in cTrader

That's exactly what I did, haha, although I came looking for an alternative with fewer steps.
Thanks for the help, Panagiotis.

PanagiotisCharalampous said: 

cortes.br said: 

I want to plot on the chart points that represent quantities calculated during the execution of the robot, such as limit and stop prices. I need the ability to draw values on the chart for debugging and visualization purposes. Specifically, I am looking for a function equivalent to PlotTimeSeries found in WealthLab.

 

 

PlotTimeSeries

public void PlotTimeSeries(TimeSeries ts, string name, string paneTag, WLColor color = default(WLColor), PlotStyles plotStyle = PlotStyle.Line, bool suppressLabels = false)

Plots a TimeSeries on the chart. The ts parameter is a TimeSeries instance. PlotTimeSeries is useful when plotting the results of mathematical operations on indicators and other TimeSeries. These operations always return instances of the TimeSeries class.

The name parameter should be a descriptive name of the data being plotted. This appears in the pane label.

The paneTag specifies which chart pane to plot the data in. You can specify Price for the price pane, Volume for the volume pane, or some other string value for a custom pane.

The color parameter is optional. If not provided, WealthLab will use a default color.

The plotStyle parameter is also optional, and is a member of the PlotStyle enum. If not specified, WealthLab will use PlotStyle.Line.

The suppressLabels parameter lets you disable to indicator pane labels and the value markers along the chart's right margin for this plot.

Why don't you do all of this in an indicator?

 


@cortes.br