public virtual void Initialize(DataSource dataSource, StreamingProvider streamingProvider, OrderProcessor orderProcessor, IStatusReporter connectionStatus) {
			this.DataSource = dataSource;
			this.StreamingProvider = streamingProvider;
			this.OrderProcessor = orderProcessor;
			this.StatusReporter = connectionStatus;
			this.AccountAutoPropagate.Initialize(this);
		}
		public void Initialize(DataSource dataSource, RepositoryJsonDataSource dataSourceRepository, RepositoryCustomMarketInfo marketInfoRepository) {
			if (base.DesignMode) return;
			this.dataSource = dataSource;
			this.dataSourceRepository = dataSourceRepository;
			this.marketInfoRepository = marketInfoRepository;
			this.populateMarketFromDataSource();
		}
		public void Initialize(DataSource dsEdit) {
			this.panel_0 = this.pnlIntro;
			if (dsEdit == null) {
				throw new Exception("DataSourceEditor can not create the DataSource; pass an existing datasource for editing, not NULL");
			}
			this.ds = dsEdit;
			this.Text = ds.Name;
			if (this.ds.Name != windowTitleDefault) {
				this.txtDataSourceName.Text = this.ds.Name;
			}
			this.txtSymbols.Text = this.ds.SymbolsCSV;
			this.PopulateScaleIntervalFromDataSource();
			this.PopulateStaticStreamingBrokerListViewsFromDataSource();

			if (this.ds.StaticProvider != null) HighlightStaticByName(this.ds.StaticProvider.GetType().Name);

			if (this.ds.StreamingProvider != null) {
				HighlightStreamingByName(this.ds.StreamingProvider.GetType().Name);
			} else {
				HighlightStreamingByName(StreamingProvider.NO_STREAMING_PROVIDER);
			}

			if (this.ds.BrokerProvider != null) HighlightBrokerByName(this.ds.BrokerProvider.GetType().Name);
			else HighlightBrokerByName(BrokerProvider.NO_BROKER_PROVIDER);

			this.marketInfoEditor.Initialize(ds, this.assemblerInstance.RepositoryJsonDataSource, this.assemblerInstance.MarketInfoRepository);
		}
//		void RaiseOnDataSourceCreateClicked() {
//			if (this.OnDataSourceNewClicked == null) {
//				string msg = "DataSourcesTree.mniNewDataSource_Click(): event OnDataSourceNewClicked: no subscribers";
//				statusReporter.PopupException(msg);
//				return;
//			}
//			this.OnDataSourceNewClicked(this, EventArgs.Empty);
//		}
		void RaiseOnDataSourceEditClicked(DataSource foundWithSameName = null) {
			if (this.OnDataSourceEditClicked == null) {
				string msg = "DataSourcesTree.mniEditDataSource_Click(): event OnDataSourceEditClicked: no subscribers";
				statusReporter.PopupException(msg);
				return;
			}
			if (foundWithSameName == null) {
				foundWithSameName = this.DataSourceSelected;
			}
			this.OnDataSourceEditClicked(this, new DataSourceEventArgs(foundWithSameName));
		}
		internal void BacktestContextInitialize(Bars bars) {
			this.preBacktestBars = this.Bars;	// this.preBacktestBars != null will help ignore this.IsStreaming saving IsStreaming state to json
			this.preDataSource = this.DataSource;
			this.preBacktestIsStreaming = this.IsStreaming;

			this.Bars = bars;
			//this.DataSource = bars.DataSource;
			this.IsStreaming = true;
			//this.Strategy.ScriptBase.Initialize(this);
		}
		int getProviderImageIndexForDataSource(DataSource dataSource) {
			var provider = dataSource.StaticProvider;
			if (provider == null) return -1;
			if (this.imageIndexByStaticProviderType.ContainsKey(provider.GetType()) == false) return -1;
			return this.imageIndexByStaticProviderType[provider.GetType()];
		}
		void populateIconForDataSource(DataSource ds) {
			if (ds == null) return;
			StaticProvider provider = ds.StaticProvider;
			if (provider == null) return;
			this.imageList.Images.Add(provider.Icon);
			int providerIconImageIndex = this.imageList.Images.Count - 1;
			if (this.imageIndexByStaticProviderType.ContainsKey(provider.GetType()) == false) {
				this.imageIndexByStaticProviderType.Add(provider.GetType(), providerIconImageIndex);
			}
		}
		public void SelectSymbol(string dataSourceName, string symbol) {
			DataSource dataSourceFound = null;
			int indexForDataSource = 0;
			int indexForSymbol = -1;
			//foreach (object dsOrSymbol in this.tree.ObjectsForClustering) {
			foreach (object shouldBeDataSource in this.tree.Objects) {
				DataSource dataSourceEach = shouldBeDataSource as DataSource;
				//if (dataSourceEach == null) continue;	//that was Symbol1-2-3
				if (dataSourceEach.Name == dataSourceName) {
					dataSourceFound = dataSourceEach;
					break;
				}
				indexForDataSource++;
				if (this.tree.IsExpanded(dataSourceEach)) {
					indexForDataSource += dataSourceEach.Symbols.Count;
				}
			}
			if (dataSourceFound == null) {
				string msg = "DATASOURCE_NOT_FOUND_IN_TREE_OBJECTS dataSourceName[" + dataSourceName + "]"
					+ "; you may have removed from DataSources before application restart"
					+ ", and one of the strategies requested the deleted datasource";
				Assembler.PopupException(msg);
				return;
			}
			if (string.IsNullOrEmpty(symbol) == false) {
				indexForSymbol = dataSourceFound.Symbols.IndexOf(symbol);
				if (indexForSymbol == -1) {
					this.tree.Expand(dataSourceFound);
					this.tree.EnsureModelVisible(dataSourceFound);
					this.tree.SelectObject(dataSourceFound);

					string msg = "SYMBOL_NOT_FOUND_IN_TREE_OBJECTS symbol[" + symbol + "]"
						+ " you may have removed from DataSources before application restart"
						+ ", and one of the strategies requested the deleted datasource";
					Assembler.PopupException(msg);
					return;
				}
			}
			
			//DOESNT_WORK_FOR_SAME_SYMBOLS_FOUND_IN_TWO_DATASOURCES this.tree.EnsureModelVisible(symbolFound);
			//DOESNT_WORK_FOR_SAME_SYMBOLS_FOUND_IN_TWO_DATASOURCES this.tree.SelectObject(symbolFound);
			int indexToSelect = indexForDataSource + indexForSymbol + 1;
			this.tree.EnsureVisible(indexToSelect);
			this.tree.SelectedIndex = indexToSelect;

			this.DataSourceSelected = dataSourceFound;
			this.SymbolSelected = symbol;
		}
		void syncSymbolAndDataSourceSelectedFromRowIndexClicked(int itemRowIndex) {
			try {
			//if ((this.tree.SelectedObject is NullReferenceException) == false) {
				// first time loaded, nothing is selected event after right click; (SelectedObject as DataSource) was NullReferenceException 
				DataSource dataSourceClicked = this.tree.SelectedObject as DataSource;
				if (dataSourceClicked != null) {
					this.DataSourceSelected = dataSourceClicked;
					this.SymbolSelected = null;
					return;
				}
			//}
			} catch (NullReferenceException) {
				string msg = "OLV_INTERNAL_EXCEPTION";
			}
			string symbol = null;
			DataSource dataSourceParent = this.tree.SelectedObject as DataSource;
			int indexCurrent = 0;
			// stop by breakpoint to see what's inside ObjectsForClustering:
			// [0] => DataSource1
			// [1] => DataSource1.Symbol1
			// [2] => DataSource1.Symbol2
			// [3] => DataSource1.Symbol3
			// [4] => DataSource2
			// [5] => DataSource2.Symbol1
			// [6] => DataSource2.Symbol2
			foreach (object dsOrSymbol in this.tree.ObjectsForClustering) {
				if (dsOrSymbol is DataSource) {
					if (dataSourceParent == null || dataSourceParent != dsOrSymbol) dataSourceParent = (DataSource)dsOrSymbol;
				} else {
					if (indexCurrent > itemRowIndex) break;
					if (indexCurrent == itemRowIndex) {
						symbol = dsOrSymbol.ToString();
						break;
					}
				}
				indexCurrent++;
			}
			this.DataSourceSelected = dataSourceParent;
			this.SymbolSelected = symbol;
		}
		public virtual void InitializeFromDataSource(DataSource dataSource) {
			this.DataSource = dataSource;
			this.StreamingDataSnapshot.InitializeLastQuoteReceived(this.DataSource.Symbols);
		}
		public virtual void Initialize(DataSource dataSource, IStatusReporter statusReporter) {
			this.StatusReporter = statusReporter;
			this.InitializeFromDataSource(dataSource);
			this.SubscribeSolidifier();
		}
		public StreamingSolidifier(DataSource dataSource) {
			this.DataSource = dataSource;
		}
		void mniltbDataSourceAddNew_UserTyped(object sender, LabeledTextBoxUserTypedArgs e) {
			string newDataSourceName = e.StringUserTyped;
			DataSource foundWithSameName = this.dataSourceRepository.ItemFind(newDataSourceName);
			if (foundWithSameName != null) {
				Assembler.InstanceInitialized.StatusReporter.DisplayStatus("DataSource[" + newDataSourceName + "] already exists");
				this.tree.EnsureModelVisible(foundWithSameName);
				this.tree.SelectObject(foundWithSameName);
				e.HighlightTextWithRed = true;
				//e.RootHandlerShouldCloseParentContextMenuStrip = true;
				return;
			}
			// literally: create, add, make it visible, emulate a click on the newborn, popup editor 
			var dataSourceNewborn = new DataSource(newDataSourceName);
			this.dataSourceRepository.ItemAdd(dataSourceNewborn, this);
			// all the rest was already done in dataSourceRepository.ItemAdd() => dataSourceRepository_OnDataSourceAdded(),
//			this.populateDataSourcesIntoTreeListView();
//			this.tree.EnsureModelVisible(foundWithSameName);
//			this.tree.SelectObject(foundWithSameName);
//			this.SelectSymbol(ds.Name);
			// but now user has selected the static provider and I want the provider's icon in the tree
			this.populateIconForDataSource(dataSourceNewborn);
			this.RaiseOnDataSourceEditClicked();	//ds
		}