internal void StrategiesTree_OnStrategyOpenNewChartClicked(object sender, StrategyEventArgs e)
        {
            Strategy strategy = e.Strategy;

            strategy.ContextSwitchCurrentToNamedAndSerialize(e.scriptContextName);
            this.chartCreateShowPopulateSelectorsSlidersFromStrategy(strategy);
        }
        internal void SlidersAutoGrow_OnScriptContextRenamed(object sender, StrategyEventArgs e)
        {
            Strategy strategy = e.Strategy;

            if (strategy.ScriptContextCurrentName != e.scriptContextName)
            {
                return;                                                                         //refresh FormTitle only when renaming current context
            }
            SlidersForm.Instance.PopulateFormTitle(strategy);
        }
        void RaiseOnScriptContextCreated(string ctxRenamedName)
        {
            if (this.ScriptContextNewDefaultCreated == null)
            {
                return;
            }
            StrategyEventArgs args = new StrategyEventArgs(
                this.Strategy.StoredInFolderRelName,
                this.Strategy, ctxRenamedName);

            this.ScriptContextNewDefaultCreated(this, args);
        }
        void RaiseOnScriptContextLoadRequested(string ctxToLoadName)
        {
            if (this.ScriptContextLoadRequestedSubscriberImplementsCurrentSwitch == null)
            {
                return;
            }
            StrategyEventArgs args = new StrategyEventArgs(
                this.Strategy.StoredInFolderRelName,
                this.Strategy, ctxToLoadName);

            this.ScriptContextLoadRequestedSubscriberImplementsCurrentSwitch(this, args);
        }
        public void StrategiesTree_OnStrategySelected(object sender, StrategyEventArgs e)
        {
            ChartForm active = this.mainForm.ChartFormActive;

            if (active == null)
            {
                e.NoActiveChartFoundToAccomodateStrategy = true;
                //USELESS Assembler.PopupException("NO_ACTIVE_CHART_FORMS_IN_DOCUMENT_PANE_TO_LOAD_STRATEGY_INTO this.mainForm.ChartFormActive=null //StrategiesTree_OnStrategySelected(" + e.Strategy + ")");
                return;
            }
            active.ChartFormManager.InitializeWithStrategy(this.mainForm, e.Strategy);
        }
        internal void SlidersAutoGrow_OnScriptContextLoadClicked(object sender, StrategyEventArgs e)
        {
            Strategy strategy = e.Strategy;

            strategy.ContextSwitchCurrentToNamedAndSerialize(e.scriptContextName);
            SlidersForm.Instance.PopulateFormTitle(strategy);
            try {
                this.mainForm.ChartFormActive.ChartFormManager.PopulateSelectorsFromCurrentChartOrScriptContextLoadBarsSaveBacktestIfStrategy("StrategiesTree_OnScriptContextLoadClicked()");
            } catch (Exception ex) {
                Assembler.PopupException("StrategiesTree_OnScriptContextLoadClicked()", ex);
            }
        }
 internal void StrategiesTree_OnStrategyOpenDefaultClicked(object sender, StrategyEventArgs e)
 {
     //v1
     //Strategy strategy = e.Strategy;
     ////strategy.ContextMarkNone();
     //strategy.ScriptContextCurrent.DataRange = SelectorsForm.Instance.BarDataRangeSelector.Popup.BarDataRange;
     //strategy.ScriptContextCurrent.ScaleInterval = SelectorsForm.Instance.BarScaleIntervalSelector.Popup.BarScaleInterval;
     //strategy.ScriptContextCurrent.PositionSize = SelectorsForm.Instance.PositionSizeSelector.Popup.PositionSize;
     //this.chartCreateShowPopulateSelectorsSliders(strategy);
     //v2
     e.scriptContextName = "Default";
     this.StrategiesTree_OnStrategyOpenNewChartClicked(sender, e);
 }
 internal void StrategiesTree_OnStrategyRenamed(object sender, StrategyEventArgs e)
 {
     foreach (ChartFormManager chartFormsManager in this.mainForm.GuiDataSnapshot.ChartFormManagers.Values)
     {
         if (chartFormsManager.Strategy != e.Strategy)
         {
             continue;
         }
         if (chartFormsManager.ScriptEditorFormConditionalInstance != null)
         {
             chartFormsManager.ScriptEditorFormConditionalInstance.Text = e.Strategy.Name;
         }
         if (chartFormsManager.ChartForm != null)
         {
             chartFormsManager.ChartForm.Text = e.Strategy.Name;
         }
     }
 }