Default value for TimeFrame as parameter

Created at 30 Sep 2015, 16:38
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!
moneybiz's avatar

moneybiz

Joined 06.12.2011

Default value for TimeFrame as parameter
30 Sep 2015, 16:38


cAlgo doesn't accept parameter type of TimeFrame to have a default value specified.

Every time when I add a bot having multiple TimeFrame parameters I need to configure each of the TimeFrame parameters manually.

It'd be nice to allow default values to be set for such parameters.

// This compiles.
[Parameter("RSI Indicator Time Frame")]
public TimeFrame RelativeStrengthIndexIndicatorTimeFrame { get; set; }

// This doesn't compile.
[Parameter("RSI Indicator Time Frame", DefaultValue = TimeFrame.Minute15)]
public TimeFrame RelativeStrengthIndexIndicatorTimeFrame { get; set; }

Error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

 

 


@moneybiz
Replies

Spotware
30 Sep 2015, 18:04

Dear Trader,

Please use the following code snippet:

[Parameter("RSI Indicator Time Frame", DefaultValue = "Minute15")]
public TimeFrame RelativeStrengthIndexIndicatorTimeFrame { get; set; }

 


@Spotware

moneybiz
30 Sep 2015, 18:39

RE:

Spotware said:

Dear Trader,

Please use the following code snippet:

[Parameter("RSI Indicator Time Frame", DefaultValue = "Minute15")]
public TimeFrame RelativeStrengthIndexIndicatorTimeFrame { get; set; }

 

Thank you, it works.

It would be nice to be able to set a default TimeFrame for the robot itself addition to the TimeZone and AccessRights parameters.


@moneybiz

harry
19 Sep 2016, 04:58

RE: RE:

Wondering how to assign the Timeframe to the RSI indicator. as the paramenters of RSI only (Source, period)

 

Thanks

 

moneybiz said:

Spotware said:

Dear Trader,

Please use the following code snippet:

[Parameter("RSI Indicator Time Frame", DefaultValue = "Minute15")]
public TimeFrame RelativeStrengthIndexIndicatorTimeFrame { get; set; }

 

Thank you, it works.

It would be nice to be able to set a default TimeFrame for the robot itself addition to the TimeZone and AccessRights parameters.

 


@harry