private void FillCross(HistoricalData historicalData, ICustomData <double, double> a) { for (int i = 0; i < historicalData.Count; i++) { (CrossDataSeries[0] as DataSeries <double, bool>).GetHistoryValue(a.GetValueByIndex(i), i); } }
public override void OnUpdate(TickStatus args) { /*if (HistoryDataSeries.Count - 1 < period) * return;*/ a1 = Mov(PriceType.Close, period, MAMode.EMA); a2 = a1.GetValueByIndex(0) - (a1.GetValueByIndex(0) * percentage / 100); a3 = a1.GetValueByIndex(0) + (a1.GetValueByIndex(0) * percentage / 100); // Both custom series is required to be supplied by value for the algorithm b1.GetValue(a1.GetValueByIndex(0)); b2.GetValue(a1.GetValueByIndex(0)); var k1 = Cross(a1, Ref(b2, 1)); var k2 = Cross(Ref(b1, 1), a1); //Search index example of a logical cross over condition based on operation input and variable relations //BarsSince(a1, InstrumentsManager.Current.DayInfo.PrevClose, Operation.Less<double>()); var s1 = BarsSince(k1) < BarsSince(k2); var s2 = s1 ? b1 : b2; Lines["a1"].SetValue(a1.GetValueByIndex(0)); Lines["s2"].SetValue(s2.GetValueByIndex(0)); }