Parameters to be shown

Created at 31 Jan 2016, 13:58
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!
MaVe's avatar

MaVe

Joined 24.08.2015

Parameters to be shown
31 Jan 2016, 13:58


How do you show two different parameters independent from each other?

(If the first is turned off, the second isn't visible too)

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AutoRescale = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class MaVe : Indicator
    {    

        [Parameter("Show Name1", DefaultValue = true)]
        public bool ShowName1 { get; set; }
        [Parameter("Show Name2", DefaultValue = true)]
        public bool ShowName2 { get; set; }

        public override void Calculate(int index)
        {        
        
            if (!ShowName1)
                return;
            ChartObjects.DrawLine("Line1", ...);
  
            if (!ShowName2)
                return;
            ChartObjects.DrawLine("Line2", ...);                
        }
    }
}

 


@MaVe
Replies

whis.gg
31 Jan 2016, 16:44

Like this?

if (ShowName1)
   ChartObjects.DrawLine("Line1", ...);
   
if (ShowName1 && ShowName2)
   ChartObjects.DrawLine("Line2", ...);   

 


@whis.gg

MaVe
31 Jan 2016, 18:53

No, the above was only to explain my intention...

How does one combine the two parameters, so that they can both be switched on/off independent from each other.


@MaVe

MaVe
31 Jan 2016, 19:18

OK, sorry. I see what you mean now. I'll try it out.


@MaVe

MaVe
01 Feb 2016, 09:31

Thanks, worked marvelous!


@MaVe