예제 #1
0
        /// <summary>
        ///Reloads the Custom Indicators.
        /// </summary>
        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 (Indicator_Store.CustomIndicatorNames.Contains(slot.IndicatorName))
                {
                    bStrategyHasCustomIndicator = true;
                    break;
                }
            }

            // Reload all the custom indicators
            Custom_Indicators.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();
                }
            }

            return;
        }
예제 #2
0
        /// <summary>
        /// Tools menu
        /// </summary>
        protected override void MenuTools_OnClick(object sender, EventArgs e)
        {
            string sName = ((ToolStripMenuItem)sender).Name;

            switch (sName)
            {
            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 { System.Diagnostics.Process.Start(Data.SourceFolder); }
                catch (System.Exception ex) { MessageBox.Show(ex.Message); }
                break;

            case "miReloadInd":
                Cursor = Cursors.WaitCursor;
                ReloadCustomIndicators();
                Cursor = Cursors.Default;
                break;

            case "miCheckInd":
                Custom_Indicators.TestCustomIndicators();
                break;

            case "CommandConsole":
                ShowCommandConsole();
                break;

            default:
                break;
            }
        }
예제 #3
0
        /// <summary>
        /// The default constructor
        /// </summary>
        public Actions()
        {
            StartPosition     = FormStartPosition.CenterScreen;
            Size              = new Size(785, 560);
            MinimumSize       = new Size(600, 370);
            Icon              = Data.Icon;
            Text              = Data.ProgramName;
            FormClosing      += new FormClosingEventHandler(Actions_FormClosing);
            Application.Idle += new EventHandler(Application_Idle);

            // Load a data file
            LoadInstrument(true);

            // Prepare custom indicators
            UpdateSplashScreeStatus("Loading custom indicators...");
            if (Configs.LoadCustomIndicators)
            {
                Custom_Indicators.LoadCustomIndicators();
            }

            // Load a strategy
            UpdateSplashScreeStatus("Loading strategy...");
            string sStrategyPath = Data.StrategyPath;

            if (Configs.RememberLastStr && Configs.LastStrategy != "")
            {
                string sLastStrategy = Path.GetDirectoryName(Configs.LastStrategy);
                if (sLastStrategy != "")
                {
                    sLastStrategy = Configs.LastStrategy;
                }
                else
                {
                    string sPath = Path.Combine(Data.ProgramDir, Data.DefaultStrategyDir);
                    sLastStrategy = Path.Combine(sPath, Configs.LastStrategy);
                }
                if (File.Exists(sLastStrategy))
                {
                    sStrategyPath = sLastStrategy;
                }
            }

            if (OpenStrategy(sStrategyPath) == 0)
            {
                CalculateStrategy(true);
                AfterStrategyOpening();
            }

            ChangeTabPage(Configs.LastTab);

            Live_Content liveContent = new Live_Content(Data.SystemDir, miLiveContent, miForex, pnlUsefulLinks, pnlForexBrokers);

            // Starting tips
            if (Configs.ShowStartingTip)
            {
                Starting_Tips startingTips = new Starting_Tips();
                startingTips.Show();
            }

            UpdateSplashScreeStatus("Loading user interface...");

            return;
        }