FI
    
        
            How can I set the default value for a "source" parameter?
            
                 21 Dec 2020, 13:49
            
                    
I have the following code.
How can I set the default value for the parameter "MAFastSource" to "High" prices? Bars.HighPrices doesn't work.
[Parameter("Fast Period", Group = "Fast MA", DefaultValue = 55, MinValue = 1)]
        public int MAFastPeriod { get; set; }
        [Parameter("Fast Type", Group = "Fast MA", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MAFastType { get; set; }
        //I want to be able to do something like this below:
        //[Parameter("Fast Source", Group = "Fast MA", DefaultValue = Bars.HighPrices)]
        [Parameter("Fast Source", Group = "Fast MA")]
        public DataSeries MAFastSource { get; set; }
        [Output("Fast MA", PlotType = PlotType.Line, LineStyle = LineStyle.Lines, LineColor = "Chocolate", Thickness = 1)]
        public IndicatorDataSeries FastMA { get; set; }
        private MovingAverage _movingAverageFast;
        protected override void Initialize()
        {
            _movingAverageFast = Indicators.MovingAverage(MAFastSource, MAFastPeriod, MAFastType);
        }
Is this possible?
Thank you.
Replies
                     PanagiotisCharalampous
                     04 Jan 2021, 10:41
                                    
Hi firemyst,
Happy new year!
Here you go
[Parameter("Fast Source", Group = "Fast MA", DefaultValue = "High")]
Best Regards,
Panagiotis
@PanagiotisCharalampous

firemyst
04 Jan 2021, 10:09 ( Updated at: 21 Dec 2023, 09:22 )
@Panagiotis:
Any help? I want to be able to set the defaults like so:
THank you and Happy New Year :-)
@firemyst