How can a cBot tell what version of cTrader it is running on (so, for instance, it can avoid attempting v5-only features if not available)?

Created at 21 Oct 2024, 19:28
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!
MA

martins

Joined 22.10.2019

How can a cBot tell what version of cTrader it is running on (so, for instance, it can avoid attempting v5-only features if not available)?
21 Oct 2024, 19:28


Is there a property or method a cBot can use that returns the cTrader version and/or environment, possibly a bit like RunningMode but with other info.

 

Also, how do we tell from the reference documentation which features are only v5, for instance these both seem not to be available in 4.9.2 (which was the current version from IC Markets only a month or 2 ago): ChartIndicators.Add & Chart.Indicators.Add - and btw which of the 2 is preferred, they both are documented…

https://help.ctrader.com/ctrader-algo/guides/chart-indicators/   
You can easily add any indicator that you have access to by calling the following method.
ChartIndicator ChartIndicators.Add(string name, params object[] parameterValues)
also on https://help.ctrader.com/ctrader-algo/references/Chart/Indicators/ChartIndicators/#add

vs

https://help.ctrader.com/ctrader-algo/articles/for-developers/how-to-manage-cbots-and-indicators-using-algos/#add-an-indicator-using-a-cbot
Define two indicators.
ChartIndicator _indicator1;
ChartIndicator _indicator2;
Add two indicators to the chart.
_indicator1 = Chart.Indicators.Add("Simple Moving Average", SourceSeries, FastPeriods, MAType);
_indicator2 = Chart.Indicators.Add("Simple Moving Average", SourceSeries, SlowPeriods, MAType);

 

Thanks.


@martins
Replies

PanagiotisCharalampous
22 Oct 2024, 05:44 ( Updated at: 22 Oct 2024, 06:19 )

Hi there,

Is there a property or method a cBot can use that returns the cTrader version and/or environment, possibly a bit like RunningMode but with other info.

You can use Application.Version

Also, how do we tell from the reference documentation which features are only v5

You can't. The documentation assumes you are using the latest version of cTrader.

Best regards,

Panagiotis


@PanagiotisCharalampous