A way to set default value of TimeFrame parameter?

Created at 07 Oct 2019, 03:30
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!
FI

firemyst

Joined 26.03.2019

A way to set default value of TimeFrame parameter?
07 Oct 2019, 03:30


Hi everyone:

Is there a way to set a default value for a TimeFrame parameter?

I have the following:

[Parameter("Long TimeFrame")]
public TimeFrame LongTimeFrame { get; set; }

When I view the cBot in cTrader, any TimeFrame parameter always comes up with "H1 (1 hour)" by default, which is not what I want.

When I change the code to be:

[Parameter("Long TimeFrame", DefaultValue = TimeFrame.Hour2)]
public TimeFrame LongTimeFrame { get; set; }

the code won't compile with the following error which I can't seem to find a way around:

An attribute element must be a constant expression, typeof expression or array creation expression of an attribute parameter type

Thank you.


@firemyst
Replies

PanagiotisCharalampous
07 Oct 2019, 09:24

Hi FireMyst,

There isn't a way at the moment.

Best Regards,

Panagiotis


@PanagiotisCharalampous