/// <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..."); }
/// <summary> /// Tools menu /// </summary> protected override void MenuTools_OnClick(object sender, EventArgs e) { string menuItemName = ((ToolStripMenuItem)sender).Name; switch (menuItemName) { case "Reset settings": ResetSettings(); break; case "miResetTrader": ResetTrader(); break; case "miInstallExpert": InstallMTFiles(); break; case "miNewTranslation": MakeNewTranslation(); break; case "miEditTranslation": EditTranslation(); break; case "miShowEnglishPhrases": Language.ShowPhrases(1); break; case "miShowAltPhrases": Language.ShowPhrases(2); break; case "miShowAllPhrases": Language.ShowPhrases(3); break; case "miOpenIndFolder": try { Process.Start(Data.SourceFolder); } catch (Exception ex) { MessageBox.Show(ex.Message); } break; case "miReloadInd": Cursor = Cursors.WaitCursor; ReloadCustomIndicators(); Cursor = Cursors.Default; break; case "miCheckInd": CustomIndicators.TestCustomIndicators(); break; case "CommandConsole": ShowCommandConsole(); break; } }