Use enum dropdown list in custom function

Created at 24 Dec 2023, 14:41
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!
AH

ahmadtrader448

Joined 29.11.2023

Use enum dropdown list in custom function
24 Dec 2023, 14:41


Hello everyone, I want to use my enum list which is used as an input parameter on a custom function to use that list over several input parameters?

My code :

        [Parameter("Field Price vs MAs Rule B"       , DefaultValue = Rules.AND, Group =  "Field Price vs MAs Buy")]
        public Rules  FPVSMAsRulesB { get; set; }

//----------------------------------------------------------

         // drop down option:
         public enum Rules
         {
             AND,
             OR,
         }
//----------------------------------------------------------

        // Function to generate Fps
        private bool ANd_OR_Corelation( ?? , bool arr, bool arr1)
        {
             var retsultrelues = false;
             switch (??)
             {
                 case 0:
                    retsultrelues =  ((arr) && (arr1)) ;
                    break;
                 case 1:
                    retsultrelues =  ((arr) || (arr1));
                    break; 
             }
            return retsultrelues ;

        }

//----------------------------------------------------------

thanks in advanced


@ahmadtrader448
Replies

PanagiotisCharalampous
27 Dec 2023, 08:27

Hi there,

Try

             switch (FPVSMAsRulesB)
             {

Best regards,

Panagiotis


@PanagiotisCharalampous