Alternatives to Parameters

Created at 22 Dec 2022, 21:02
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!
CT

ctid5083541

Joined 25.05.2022

Alternatives to Parameters
22 Dec 2022, 21:02


Are there any alternatives to parameters. I know of output but my programming skills are somewhat basic. I don't see the point in using a parameter if I'm only going to use one of the options. I'm also hoping it will speed up the program. I seem to have gotten around some of the color parameters but others are a more difficult that have text as a user defined input. A simple example may get the job done. It's difficult to provide an example as I've edited this program all over the place. Thanks in advance for any assistance.


@ctid5083541
Replies

PanagiotisChar
23 Dec 2022, 09:44

Hi there,

Your question is not very clear. What do you mean by "alternative to parameters". Which parameters are you talking about and why do you need to use an alternative?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar

ctid5083541
23 Dec 2022, 11:53

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class OrderFlowTicks : Indicator
    {
        public enum GetMyData
        {
            On_Chart,
            Today,
            Yesterday,
            Weekly,
            Bi_Week,
            Monthly,
            Customized
        }

        [Parameter("Load From", DefaultValue = GetMyData.On_Chart, Group = "SETTINGS")]
        public GetMyData GetMyDataChoice { get; set; }

        [Parameter("Custom (dd/mm/yyyy)", DefaultValue = "00/00/0000", Group = "SETTINGS")]
        public string strDate { get; set; }

        public enum ReturnedType_Data
        {
            Percentage,
            Value,
            PercentageAndValue
        }
        [Parameter("Returned Type", DefaultValue = ReturnedType_Data.Percentage, Group = "OUTPUT")]
        public ReturnedType_Data ReturnedType_Choice { get; set; }

        [Parameter("Row Height", DefaultValue = 1.0, MinValue = 0.1, Group = "FORMATTING")]
        public double myHeight { get; set; } 

        [Parameter("Sell Color", DefaultValue = Colors.Green, Group = "BUY/SELL")]
        public Colors mySellColor { get; set; }

And many other Parameter Inputs.

None of these settings will ever change. I have some complex nested if statements referring to these Parameter Inputs which have to be executed if the value never changes - it just makes the code more labor intensive than it needs to be. I want to take out the if statements and at the same time speed up the running of the program that currently takes a long time to load initially.

Many thanks!


@ctid5083541

PanagiotisChar
23 Dec 2022, 12:55

Hi there,

Then just replace the parameters with constant values and remove them. Why do you need an alternative?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us


@PanagiotisChar