public void AbsorbFrom(ContextChart found) {
			if (found == null) return;
			//KEEP_CLONE_UNDEFINED this.Name = found.Name;
			this.Symbol = found.Symbol;
			this.DataSourceName = found.DataSourceName;
			this.ScaleInterval = found.ScaleInterval.Clone();
			this.DataRange = found.DataRange.Clone();
			//this.ChartBarSpacing = found.ChartBarSpacing;
			this.ChartStreaming = found.ChartStreaming;
			this.ShowRangeBar = found.ShowRangeBar;
		}
Beispiel #2
0
 public void AbsorbFrom(ContextChart found)
 {
     if (found == null)
     {
         return;
     }
     //KEEP_CLONE_UNDEFINED this.Name = found.Name;
     this.Symbol         = found.Symbol;
     this.DataSourceName = found.DataSourceName;
     this.ScaleInterval  = found.ScaleInterval.Clone();
     this.DataRange      = found.DataRange.Clone();
     //this.ChartBarSpacing = found.ChartBarSpacing;
     this.ChartStreaming = found.ChartStreaming;
     this.ShowRangeBar   = found.ShowRangeBar;
 }
		public void InitializeChartNoStrategy(MainForm mainForm, ContextChart contextChart) {
			string msig = "ChartFormsManager.InitializeChartNoStrategy(" + contextChart + "): ";
			this.MainForm = mainForm;

			if (this.DataSnapshot.ChartSerno == -1) {
				int charSernoNext = mainForm.GuiDataSnapshot.ChartSernoNextAvailable;
				bool createdNewFile = this.DataSnapshotSerializer.Initialize(Assembler.InstanceInitialized.AppDataPath,
					"ChartFormDataSnapshot-" + charSernoNext + ".json", "Workspaces",
					Assembler.InstanceInitialized.AssemblerDataSnapshot.CurrentWorkspaceName, true, true);
				this.DataSnapshot = this.DataSnapshotSerializer.Deserialize();	// will CREATE a new ChartFormDataSnapshot and keep the reference for further Serialize(); we should fill THIS object
				this.DataSnapshot.ChartSerno = charSernoNext;
				this.DataSnapshotSerializer.Serialize();
			}

			this.ChartForm = new ChartForm(this);
			this.DataSnapshot.StrategyGuidJsonCheck = "NO_STRATEGY_CHART_ONLY";
			if (this.DataSnapshot.ChartSettings == null) {
				// delete "ChartSettings": {} from JSON to reset to ChartControl>Design>ChartSettings>Properties 
				this.DataSnapshot.ChartSettings = this.ChartForm.ChartControl.ChartSettings;	// opening from Datasource => save
			} else {
				this.ChartForm.ChartControl.ChartSettings = this.DataSnapshot.ChartSettings;	// otherwize JustDeserialized => propagate
				this.ChartForm.ChartControl.PropagateSettingSplitterDistancePriceVsVolume();
			}
			if (contextChart != null) {
				// contextChart != null when opening from Datasource; contextChart == null when JustDeserialized
				this.DataSnapshot.ContextChart = contextChart;
			}
			this.DataSnapshotSerializer.Serialize();

			this.ChartForm.FormClosed += this.MainForm.MainFormEventManager.ChartForm_FormClosed;

			//this.ChartForm.CtxReporters.Enabled = false;
			this.ChartForm.DdbReporters.Enabled = false;
			this.ChartForm.DdbBacktest.Enabled = false;
			this.ChartForm.DdbStrategy.Enabled = false;
			this.ChartForm.MniShowSourceCodeEditor.Enabled = false;
			
			this.EventManager = new ChartFormEventManager(this);
			this.ChartForm.AttachEventsToChartFormsManager();
						
			try {
				this.PopulateSelectorsFromCurrentChartOrScriptContextLoadBarsSaveBacktestIfStrategy(msig);
			} catch (Exception ex) {
				string msg = "PopulateCurrentChartOrScriptContext(): ";
				Assembler.PopupException(msg + msig, ex);
			}
		}
		public void PropagateContextChartOrScriptToLTB(ContextChart ctxChart, Bitmap streamingProviderIcon = null) {
			if (base.InvokeRequired) {
				base.BeginInvoke((MethodInvoker)delegate { this.PropagateContextChartOrScriptToLTB(ctxChart, streamingProviderIcon); });
				return;
			}
			
			if (streamingProviderIcon != null) {
				this.btnStreaming.Image = streamingProviderIcon;
			}
			// from btnStreaming_Click(); not related but visualises the last clicked state
			if (this.btnStreaming.Checked) {
				this.mniBacktestOnSelectorsChange.Enabled = false;
				this.mniBacktestNow.Enabled = false;
				this.btnAutoSubmit.Enabled = true;
			} else {
				this.mniBacktestOnSelectorsChange.Enabled = true;
				this.mniBacktestNow.Enabled = true;
				this.btnAutoSubmit.Enabled = false;
			}
			
			if (ctxChart.ShowRangeBar) {
				this.ChartControl.RangeBarCollapsed = false; 
				this.mniShowBarRange.Checked = true;
			} else {
				this.ChartControl.RangeBarCollapsed = true; 
				this.mniShowBarRange.Checked = false;
			}

			this.btnStreaming.Checked = ctxChart.ChartStreaming;
			ContextScript ctxScript = ctxChart as ContextScript;
			if (ctxScript == null) return;
			
			this.mniBacktestOnRestart.Checked = ctxScript.BacktestOnRestart;
			this.mniBacktestOnSelectorsChange.Checked = ctxScript.BacktestOnSelectorsChange;
			this.btnAutoSubmit.Checked = ctxScript.ChartAutoSubmitting;
			this.PropagateContextScriptToLTB(ctxScript);
		}
		void chartCreateShowPopulateSelectorsSlidersNoStrategy(ContextChart contextChart) {
			ChartFormManager chartFormManager = new ChartFormManager();
			chartFormManager.InitializeChartNoStrategy(this.mainForm, contextChart);
			this.mainForm.GuiDataSnapshot.ChartFormManagers.Add(chartFormManager.DataSnapshot.ChartSerno, chartFormManager);
			chartFormManager.ChartFormShow();
		}
		internal void DataSourcesTree_OnNewChartForSymbolClicked(object sender, DataSourceSymbolEventArgs e) {
			ContextChart contextChart = new ContextChart("CHART_" + e.Symbol);
			contextChart.DataSourceName = e.DataSource.Name;
			contextChart.Symbol = e.Symbol;
			contextChart.ScaleInterval = e.DataSource.ScaleInterval;
			//this.chartCreateShowPopulateSelectorsSliders(contextChart);
			this.chartCreateShowPopulateSelectorsSlidersNoStrategy(contextChart);
		}
		public ContextScript(ContextChart upgradingFromSimpleChart = null, string name = "UNDEFINED") : this(name) {
			base.AbsorbFrom(upgradingFromSimpleChart);
		}
Beispiel #8
0
 public ContextScript(ContextChart upgradingFromSimpleChart = null, string name = "UNDEFINED") : this(name) {
     base.AbsorbFrom(upgradingFromSimpleChart);
 }