コード例 #1
0
        private void CreateCustomTab(CustomTabToParametersUi tab)
        {
            TabItem item = new TabItem();

            item.Header  = tab.Label;
            item.Content = tab.GridToPaint;

            TabControlSettings.Items.Add(item);
        }
コード例 #2
0
        public CustomParamsUseBotSample(string name, StartProgram startProgram) : base(name, startProgram)
        {
            TabCreate(BotTabType.Simple);
            _tab = TabsSimple[0];

            Regime = CreateParameter("Regime", "Off", new string[] { "Off", "On" }, "Base");

            //делаем простотую надпись, которая будет разделять параметры в таблице
            CreateParameterLabel("labelSample", "Base", "Params", 30, 15, System.Drawing.Color.White, "Base");

            AtrCountToInter = CreateParameter("Atr count", 4m, 1, 10, 1, "Base");

            Volume = CreateParameter("Volume", 1, 1, 100000, 1m, "Base");

            FastSmaLen = CreateParameter("Fast sma len", 15, 5, 50, 1, "Indicators");

            SlowSmaLen = CreateParameter("Slow sma len", 50, 5, 50, 1, "Indicators");

            AtrLen = CreateParameter("Atr len", 50, 5, 50, 1, "Indicators");

            StopLenPercent = CreateParameter("Stop percent", 0.5m, 1, 10, 1, "Exit settings");

            ProfitLenPercent = CreateParameter("Profit percent", 0.5m, 1, 10, 1, "Exit settings");

            _fastSma = IndicatorsFactory.CreateIndicatorByName("Sma", name + "Sma", false);
            _fastSma = (Aindicator)_tab.CreateCandleIndicator(_fastSma, "Prime");
            _fastSma.ParametersDigit[0].Value = FastSmaLen.ValueInt;
            _fastSma.Save();

            _slowSma = IndicatorsFactory.CreateIndicatorByName("Sma", name + "SmaSlow", false);
            _slowSma = (Aindicator)_tab.CreateCandleIndicator(_slowSma, "Prime");
            _slowSma.ParametersDigit[0].Value = SlowSmaLen.ValueInt;
            _slowSma.Save();

            _atr = IndicatorsFactory.CreateIndicatorByName("ATR", name + "art", false);
            _atr = (Aindicator)_tab.CreateCandleIndicator(_atr, "AtrArea");
            _atr.ParametersDigit[0].Value = AtrLen.ValueInt;
            _atr.Save();

            ParametrsChangeByUser += CustomParamsUseBotSample_ParametrsChangeByUser;

            _tab.CandleFinishedEvent += _tab_CandleFinishedEvent;

            // customization param ui

            this.ParamGuiSettings.Title  = "Custom param gui sample";
            this.ParamGuiSettings.Height = 800;
            this.ParamGuiSettings.Width  = 600;

            // 1 tab creation
            CustomTabToParametersUi customTab = ParamGuiSettings.CreateCustomTab("Indicators values");

            // 2 add on custom tab children control
            // customTab.GridToPaint - it`s a control for your children controls
            CreateTable();
            customTab.AddChildren(_host);
        }