/// <summary> ///Reloads the Custom Indicators. /// </summary> private void ReloadCustomIndicators() { // Check if the strategy contains custom indicators bool bStrategyHasCustomIndicator = false; foreach (IndicatorSlot slot in Data.Strategy.Slot) { // Searching the strategy slots for a custom indicator if (IndicatorStore.CustomIndicatorNames.Contains(slot.IndicatorName)) { bStrategyHasCustomIndicator = true; break; } } // Reload all the custom indicators CustomIndicators.LoadCustomIndicators(); if (bStrategyHasCustomIndicator) { // Load and calculate a new strategy Data.StrategyDir = Path.Combine(Data.ProgramDir, Data.DefaultStrategyDir); if (OpenStrategy(Path.Combine(Data.StrategyDir, "New.xml")) == 0) { CalculateStrategy(true); AfterStrategyOpening(); } } }
/// <summary> /// The default constructor /// </summary> private Actions() { StartPosition = FormStartPosition.CenterScreen; Size = new Size(785, 560); MinimumSize = new Size(600, 370); Icon = Data.Icon; Text = Data.ProgramName; FormClosing += ActionsFormClosing; Application.Idle += ApplicationIdle; // Load a data file LoadInstrument(); // Prepare custom indicators UpdateSplashScreeStatus("Loading custom indicators..."); if (Configs.LoadCustomIndicators) { CustomIndicators.LoadCustomIndicators(); } // Load a strategy UpdateSplashScreeStatus("Loading strategy..."); string strategyPath = Data.StrategyPath; if (Configs.LastStrategy != "" && (Configs.RememberLastStr || Data.ConnectionID > 0)) { string lastStrategy = Path.GetDirectoryName(Configs.LastStrategy); if (lastStrategy != "") { lastStrategy = Configs.LastStrategy; } else { string path = Path.Combine(Data.ProgramDir, Data.DefaultStrategyDir); lastStrategy = Path.Combine(path, Configs.LastStrategy); } if (File.Exists(lastStrategy)) { strategyPath = lastStrategy; } } if (OpenStrategy(strategyPath) == 0) { CalculateStrategy(true); AfterStrategyOpening(); } ChangeTabPage(Configs.LastTab); LiveContent.CheckForUpdate(Data.SystemDir, MILiveContent, MIForex, PnlUsefulLinks, PnlForexBrokers); // Starting tips if (Configs.ShowStartingTip) { var startingTips = new StartingTips(); startingTips.Show(); } UpdateSplashScreeStatus("Loading user interface..."); }