public virtual void Initialise(StockSerie stockSerie, StockOrder lastBuyOrder, bool supportShortSelling) { this.Serie = stockSerie; this.LastBuyOrder = lastBuyOrder; this.SupportShortSelling = supportShortSelling; // Initialise trigger indicator IStockViewableSeries triggerSerie = this.TriggerIndicator as IStockViewableSeries; if (triggerSerie != null) { if (stockSerie.HasVolume || !triggerSerie.RequiresVolumeData) { this.triggerIndicator = stockSerie.GetStockEvents(triggerSerie); } else { throw new System.Exception("This serie has no volume information but is required for " + triggerSerie.Name); } try { BuyTriggerEventIndex = this.TriggerIndicator.EventNames.ToList().IndexOf(BuyTriggerEventName); } catch { throw new System.Exception("This indicator has no triggering event" + triggerSerie.Name + "(" + OkToBuyFilterEventName + ")"); } try { ShortTriggerEventIndex = this.TriggerIndicator.EventNames.ToList().IndexOf(ShortTriggerEventName); } catch { throw new System.Exception("This indicator has no triggering event" + triggerSerie.Name + "(" + OkToShortFilterEventName + ")"); } } // Initialise filter indicator IStockViewableSeries filterSerie = this.FilterIndicator as IStockViewableSeries; if (filterSerie != null) { if (stockSerie.HasVolume || !filterSerie.RequiresVolumeData) { this.filterIndicator = stockSerie.GetStockEvents(filterSerie); } else { throw new System.Exception("This serie has no volume information but is required for " + filterSerie.Name); } // Get event indexes try { OkToBuyFilterEventIndex = this.FilterIndicator.EventNames.ToList().IndexOf(OkToBuyFilterEventName); } catch { throw new System.Exception("This indicator has no filtering event" + filterSerie.Name + "(" + OkToBuyFilterEventName + ")"); } try { OkToShortFilterEventIndex = this.FilterIndicator.EventNames.ToList().IndexOf(OkToShortFilterEventName); } catch { throw new System.Exception("This indicator has no filtering event" + filterSerie.Name + "(" + OkToShortFilterEventName + ")"); } } }