protected void Beat() // Sequences beats in the propper order and triggers their events. Invoked by OnEnable() { lastBeat = Time.time; if (showTiming) { Debug.Log(lastMainIndex + "-" + lastOffIndex + ":\n" + System.DateTime.Now.Second + "." + System.DateTime.Now.Millisecond); } if (visualizeBeat && beatGraphic) { if (beatGraphic.localScale == Vector3.one) { beatGraphic.localScale *= 2; } else { beatGraphic.localScale = Vector3.one; // Displays the beat on-screen directly } } if (++lastOffIndex > offBeats) // Next Main Beat { lastOffIndex = 0; if (++lastMainIndex > beats) // Next Bar { lastMainIndex = 0; NewBar?.Invoke(); } OnBeat?.Invoke(); if (lastMainIndex == beats) { OnBeatLast?.Invoke(); } } else // Next Off Beat { OffBeat?.Invoke(); if (lastOffIndex == offBeats /* && lastMainIndex == beats*/) { OffBeatLast?.Invoke(); } } }
internal void OnAddBar(int row, int rowCount, string securityId, SmartBarInterval interval, DateTime time, double open, double high, double low, double close, double volume, double openInt) { NewBar.SafeInvoke(row, rowCount, securityId, SmartComTimeFrames.GetTimeFrame(interval), time, open.ToDecimal(), high.ToDecimal(), low.ToDecimal(), close.ToDecimal(), volume.ToDecimal(), openInt.ToDecimal()); }
internal void OnAddBar(int row, int rowCount, string securityId, SmartBarInterval interval, DateTime time, double open, double high, double low, double close, double volume, double openInt) { NewBar.SafeInvoke(row, rowCount, securityId, SmartComTimeFrames.GetTimeFrame(interval), time, SafeCast(open), SafeCast(high), SafeCast(low), SafeCast(close), SafeCast(volume), SafeCast(openInt)); }
private void OnNewBar(string symbol, string datafeed) => NewBar?.Invoke(this, new Tuple <string, string>(symbol, datafeed));