Parameter's checkbox unchecked by default

Created at 02 Aug 2016, 00:05
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!
CR

croucrou

Joined 24.02.2016

Parameter's checkbox unchecked by default
02 Aug 2016, 00:05


Hello,

is it possible to code a parameter, so it would be unselected by default?

Thank you.


@croucrou
Replies

Spotware
04 Aug 2016, 16:56

Dear Trader,

Please be advised that you can use  the following statement: 

        [Parameter(DefaultValue = false)]
        public bool Parameter { get; set; }


@Spotware

croucrou
06 Aug 2016, 16:47

I am sorry, I was thinking about the output.

Would that be possible to set it to unchecked by default?


@croucrou

Spotware
09 Aug 2016, 15:07

Sorry, could you be more specific about what you are trying to do. 


@Spotware

croucrou
09 Aug 2016, 17:45

I.e. if the indicator had two lines, I would like only one to be displayed by default and the other would be optional.


@croucrou

croucrou
19 Aug 2016, 16:48

Spotware?


@croucrou

kricka
20 Aug 2016, 15:50

True and False

If there are only two choices in the parameter setup you can use the true and false statement. Below is an example.

[Parameter("Indicator 1 = 1,  Indicator 2 = 2 ", DefaultValue = true)]
        public bool Indicators { get; set; }

Then you have to put the logic in the code.

protected override void OnTick()
        {

if (Indicators == true)

ChartObjects.DrawText("Show Indicator 1", "\n" + "\n" + "\n" + , StaticPosition.TopRight, Colors.Green);

if (Indicators == false)

ChartObjects.DrawText("Show Indicator 2", "\n" + "\n" + "\n" + , StaticPosition.TopRight, Colors.Red);

I am using ChartObjects.DrawText but you can use any method.


@kricka

croucrou
20 Aug 2016, 19:15 ( Updated at: 21 Dec 2023, 09:20 )

Okay, but can't you just do it like:


@croucrou