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); }
public ParemetrsUi(List <IIStrategyParameter> parameters, ParamGuiSettings settings) { InitializeComponent(); Height = (double)settings.Height; Width = (double)settings.Width; _parameters = parameters; ButtonAccept.Content = OsLocalization.Entity.ButtonAccept; if (string.IsNullOrEmpty(settings.Title)) { Title = OsLocalization.Entity.TitleParametersUi; } else { Title = settings.Title; } List <List <IIStrategyParameter> > sorted = GetParamSortedByTabName(); for (int i = 0; i < sorted.Count; i++) { if (sorted[i][0].TabName == null) { CreateTab(sorted[i], settings.FirstTabLabel); } else { CreateTab(sorted[i], sorted[i][0].TabName); } } for (int i = 0; i < settings.CustomTabs.Count; i++) { CreateCustomTab(settings.CustomTabs[i]); } }