public void SelectNextTimeScale() { switch(timeScale){ case TimeScale.ONE: timeScale = TimeScale.TWO; if (isPlaying) { Time.timeScale = 2f; } if (TimeScaleChange != null){ TimeScaleChange(); } break; case TimeScale.TWO: timeScale = TimeScale.THREE; if (isPlaying) { Time.timeScale = 3f; } if (TimeScaleChange != null){ TimeScaleChange(); } break; case TimeScale.THREE: timeScale = TimeScale.ONE; if (isPlaying) { Time.timeScale = 1f; } if (TimeScaleChange != null){ TimeScaleChange(); } break; } }
private static double GetScaleToTicksRatio(TimeScale scale) { switch(scale) { case TimeScale.Ticks: return 1.0d; case TimeScale.Nanoseconds: return 1E-2d; case TimeScale.Microseconds: return 1E1d; case TimeScale.Milliseconds: return 1E4d; case TimeScale.Seconds: return 1E7d; default: return 1.0d; } }
/// <summary> /// Creates a new instance of the WaveGenerator class /// <param name="scale">Specifies which time scale to use</param> /// </summary> public TrigWaveGenerator(TimeScale scale, bool isContinuous = false) { mTimeScale = scale; mContinuous = isContinuous; }
/// <summary> /// Subscribes a method to be invoked with the given frequency on the given timescale /// </summary> /// <param name="frequency"></param> /// <param name="action"></param> /// <param name="behaviour"></param> /// <param name="timeScale"></param> public static void Add(float frequency, System.Action action, MonoBehaviour behaviour, TimeScale timeScale = TimeScale.Delta) { Dictionary <float, FrequencyUpdateBatch> selected = null; switch (timeScale) { case TimeScale.Delta: selected = get.update; break; case TimeScale.FixedDelta: selected = get.fixedUpdate; break; } if (!selected.ContainsKey(frequency)) { selected.Add(frequency, new FrequencyUpdateBatch(frequency)); } selected[frequency].Add(action, behaviour); }
private void Awake() { ts = GetComponent <TimeScale>(); agent = GetComponent <NavMeshAgent>(); }
public MaxWait(float abortOn, TimeScale timeScale) { this.abortOn = abortOn; this.timeScale = timeScale; }
//------------------------------------------------------------------------/ // CTOR //------------------------------------------------------------------------/ public StratusActionGroup(TimeScale mode = TimeScale.Delta) : base(mode) { }
//Should yield the same results regardless of what chandles are used for input, but faster on closer candles private static List <PriceCandle> CreatePriceCandleList(IReadOnlyList <PriceCandle> price_candles, TimeScale time_scale) { if (price_candles.Count == 0) { return(new List <PriceCandle>()); } //Set times next candle DateTimeUTC open_time = PriceCandle.GetOpenTime(price_candles[0].OpenTime, time_scale); DateTimeUTC close_time = PriceCandle.GetCloseTime(open_time, time_scale); int current_candle_index = 0; //if we do not start on a candle open: if (price_candles[0].OpenTime != open_time) { //Wind forward to first candle in the next candle while ((current_candle_index < price_candles.Count) && (price_candles[current_candle_index].OpenTime != close_time)) { current_candle_index++; } //Set times next candle open_time = PriceCandle.GetOpenTime(close_time, time_scale); close_time = PriceCandle.GetCloseTime(open_time, time_scale); } if (price_candles.Count <= current_candle_index) { return(new List <PriceCandle>()); } //Work List <PriceCandle> new_price_candles = new List <PriceCandle>(); double open_bid = price_candles[current_candle_index].OpenBid; double high_bid = price_candles[current_candle_index].HighBid; double low_bid = price_candles[current_candle_index].LowBid; double close_bid = price_candles[current_candle_index].CloseBid; double open_ask = price_candles[current_candle_index].OpenAsk; double high_ask = price_candles[current_candle_index].HighAsk; double low_ask = price_candles[current_candle_index].LowAsk; double close_ask = price_candles[current_candle_index].CloseAsk; while (current_candle_index < price_candles.Count) { //If it is the end of our current price candle if (price_candles[current_candle_index].CloseTime == close_time) { // Update everything one last time //open_bid = high_bid = price_candles[current_candle_index].HighBid; low_bid = price_candles[current_candle_index].LowBid; close_bid = price_candles[current_candle_index].CloseBid; //open_ask = high_ask = price_candles[current_candle_index].HighAsk; low_ask = price_candles[current_candle_index].LowAsk; close_ask = price_candles[current_candle_index].CloseAsk; // Create candle new_price_candles.Add(new PriceCandle( open_time, time_scale, open_bid, high_bid, low_bid, close_bid, open_ask, high_ask, low_ask, close_ask, 0, 0)); //Set begin and end for our next candle open_time = PriceCandle.GetOpenTime(close_time, time_scale); close_time = PriceCandle.GetCloseTime(open_time, time_scale); //scroll forward current_candle_index++; //And if there is a next candle: if (current_candle_index < price_candles.Count) { // initialize open_bid = price_candles[current_candle_index].OpenBid; high_bid = price_candles[current_candle_index].HighBid; low_bid = price_candles[current_candle_index].LowBid; close_bid = price_candles[current_candle_index].CloseBid; open_ask = price_candles[current_candle_index].OpenAsk; high_ask = price_candles[current_candle_index].HighAsk; low_ask = price_candles[current_candle_index].LowAsk; close_ask = price_candles[current_candle_index].CloseAsk; } } else { //If we are not the end we must be some part so just update data //open_bid = high_bid = Math.Max(high_bid, price_candles[current_candle_index].HighBid); low_bid = Math.Min(low_bid, price_candles[current_candle_index].LowBid); close_bid = price_candles[current_candle_index].CloseBid; // open_ask = high_ask = Math.Max(high_ask, price_candles[current_candle_index].HighAsk); low_ask = Math.Min(low_ask, price_candles[current_candle_index].LowAsk); close_ask = price_candles[current_candle_index].CloseAsk; //scroll forward current_candle_index++; } } return(new_price_candles); }
private static string GetScaleUnit(TimeScale scale) { switch(scale) { case TimeScale.Ticks: return "t"; case TimeScale.Nanoseconds: return "ns"; case TimeScale.Microseconds: return "µs"; case TimeScale.Milliseconds: return "ms"; case TimeScale.Seconds: return "s"; default: return String.Empty; } }
/// <summary> /// Rotates the transform to have its forward aligned towards a target over a specified duration /// </summary> /// <param name="transform"></param> /// <param name="targetPosition"></param> /// <param name="duration"></param> /// <param name="timeScale"></param> /// <returns></returns> public static IEnumerator LookAt(Transform transform, Transform target, float duration, TimeScale timeScale = TimeScale.FixedDelta) { Quaternion startingRot = transform.rotation; System.Action <float> func = (float t) => { Vector3 lookAtVec = target.position - transform.position; Quaternion nextRot = Quaternion.LookRotation(lookAtVec); transform.rotation = Quaternion.Lerp(startingRot, nextRot, t); }; //IEnumerator lerp = Lerp(func, duration); //yield return lerp; yield return(Lerp(func, duration, timeScale)); }
/// <summary> /// Follows the specified target while the given condition is true /// </summary> /// <param name="transform"></param> /// <param name="target"></param> /// <param name="speed"></param> /// <param name="condition"></param> /// <param name="stopDistance"></param> /// <param name="timeScale"></param> /// <returns></returns> public static IEnumerator FollowWhile(Transform transform, Transform target, float speed, System.Func <bool> condition, float stopDistance = 0.0f, TimeScale timeScale = TimeScale.Delta) { while (condition.Invoke()) { FollowProcedure(transform, target, speed, stopDistance, timeScale.GetTime()); yield return(timeScale.Yield()); } }
/// <summary> /// The transform will follow the specified target at a specified speed for a given duration /// until the duration elapses /// </summary> /// <param name="transform"></param> /// <param name="target"></param> /// <param name="speed"></param> /// <param name="duration"></param> /// <param name="stopDistance"></param> /// <param name="timeScale"></param> /// <returns></returns> public static IEnumerator FollowUntil(Transform transform, Transform target, float speed, float duration, float stopDistance = 0.0f, TimeScale timeScale = TimeScale.Delta) { while (duration > 0f) { float dt = timeScale.GetTime(); duration -= dt; FollowProcedure(transform, target, speed, stopDistance, dt); yield return(timeScale.Yield()); } }
/// <summary> /// Makes the transform follow the specified target at a specified speed and given distance until cancelled. /// Optionally, it can be forced to maintain the given distance /// </summary> /// <param name="transform"></param> /// <param name="target"></param> /// <param name="speed"></param> /// <param name="distance"></param> /// <param name="maintainDistance"></param> /// <param name="timeScale"></param> /// <returns></returns> public static IEnumerator Follow(Transform transform, Transform target, float speed, float distance = 0.0f, bool maintainDistance = false, TimeScale timeScale = TimeScale.Delta) { while (true) { FollowProcedure(transform, target, speed, distance, timeScale.GetTime(), maintainDistance); yield return(timeScale.Yield()); } }
/// <summary> /// Moves the transform from its current position to the target position over a specified duration by translation /// </summary> /// <param name="transform"></param> /// <param name="endPos"></param> /// <param name="duration"></param> /// <returns></returns> public static IEnumerator MoveTo(Transform transform, Vector3 endPos, float duration, float distFromTarget = 0f, System.Action onFinished = null, TimeScale timeScale = TimeScale.Delta) { Vector3 startPos = transform.position; if (distFromTarget > 0f) { endPos = startPos.CalculatePositionAtDistanceFromTarget(endPos, distFromTarget); } System.Action <float> func = (float t) => { Vector3 nextPos = Vector3.Lerp(startPos, endPos, t); transform.position = nextPos; }; //IEnumerator lerp = Lerp(func, duration); //yield return lerp; yield return(Lerp(func, duration, timeScale)); onFinished?.Invoke(); }
/// <summary> /// Rotates around a given pivot until cancelled /// </summary> /// <param name="transform"></param> /// <param name="pivot"></param> /// <param name="axis"></param> /// <param name="degrees"></param> /// <returns></returns> public static IEnumerator RotateAround(Transform transform, Vector3 pivot, Vector3 axis, float degrees, System.Action onFinished = null, TimeScale timeScale = TimeScale.FixedDelta) { while (true) { float step = degrees * timeScale.GetTime(); transform.RotateAround(pivot, axis, step); yield return(timeScale.Yield()); } }
public RobustHistogram(TimeScale scale) { this.Clear(); this.Scale = scale; this.TicksToUnit = GetScaleToTicksRatio(scale); }
/// <summary> /// Rotates the transform to have its forward aligned towards a target until cancelled /// </summary> /// <param name="transform"></param> /// <param name="target"></param> /// <param name="speed"></param> /// <param name="timeScale"></param> /// <returns></returns> public static IEnumerator Track(Transform transform, Transform target, float speed, TimeScale timeScale = TimeScale.FixedDelta) { while (true) { Vector3 lookAtVec = target.position - transform.position; float dt = timeScale.GetTime(); transform.forward = Vector3.Lerp(transform.forward, lookAtVec, dt * speed); yield return(timeScale.Yield()); } }
// Start is called before the first frame update void Start() { currentPanelRectTrans = (RectTransform)transform.Find("CurrentPanel"); fillImage = currentPanelRectTrans.Find("FillImage").GetComponentInChildren <Image>(); fighterTimeScale = fighterIns.GetComponent <TimeScale>(); }
/// <summary> /// Applies the given curve to the transform's scale over a given duration /// </summary> /// <param name="transform"></param> /// <param name="curve"></param> /// <param name="duration"></param> /// <param name="timeScale"></param> /// <returns></returns> public static IEnumerator Scale(Transform transform, AnimationCurve curve, float duration, TimeScale timeScale = TimeScale.FixedDelta) { Vector3 startingVal = transform.localScale; Vector3 endinvgVal = startingVal * curve.Evaluate(duration); System.Action <float> scalingFunc = (float t) => { Vector3 nextVal = Vector3.Lerp(startingVal, endinvgVal, curve.Evaluate(t)); transform.localScale = nextVal; }; yield return(Lerp(scalingFunc, duration, timeScale)); }
private void Awake() { kp = GetComponent <KeyPoints>(); ts = GetComponent <TimeScale>(); }
/// <summary> /// Applies the scalar to the transform's current scale over a given duration /// </summary> /// <param name="transform"></param> /// <param name="scalar"></param> /// <param name="duration"></param> /// <param name="timeScale"></param> /// <returns></returns> public static IEnumerator Scale(Transform transform, float scalar, float duration, TimeScale timeScale = TimeScale.FixedDelta) { Vector3 startingVal = transform.localScale; Vector3 endingVal = transform.localScale * scalar; System.Action <float> func = (float t) => ScaleProcedure(transform, startingVal, endingVal, t); yield return(Lerp(func, duration, timeScale)); }
private void Awake() { agent = GetComponent <NavMeshAgent>(); ts = GetComponent <TimeScale>(); soundArray = GetComponent <SoundArray>(); }
/// <summary> /// Applies the given scales to the transformation in sequence over a given duration /// </summary> /// <param name="transform"></param> /// <param name="scalingCurves"></param> /// <param name="totalDuration"></param> /// <param name="repeat"></param> /// <param name="timeScale"></param> /// <returns></returns> public static IEnumerator Scale(Transform transform, AnimationCurve[] scalingCurves, float totalDuration, bool repeat = false, TimeScale timeScale = TimeScale.FixedDelta) { Vector3 originalScale = transform.localScale; float durationForEach = totalDuration / scalingCurves.Length; do { foreach (var scale in scalingCurves) { Trace.Script("Scaling to " + scale); yield return(Scale(transform, scale, durationForEach, timeScale)); } } while (repeat); }
public static WaitForFuture <A> coroutineWait <A>( this Future <A> f, Duration maxWait, TimeScale timeScale = TimeScale.Realtime ) => new WaitForFuture <A>(f, F.some(new MaxWait( timeScale.now() + maxWait.seconds, timeScale )));
public static IEnumerator Rotate(Transform transform, Vector3 rotation, float duration, TimeScale timeScale = TimeScale.FixedDelta) { Quaternion initialRotation = transform.rotation; Quaternion targetRotation = Quaternion.Euler(rotation); System.Action <float> func = (float t) => { transform.rotation = Quaternion.Lerp(initialRotation, targetRotation, t); }; yield return(Lerp(func, duration)); }
public static void AddPriceCandle(PlotLine2D line_plot_2d, PriceSet price_set, TimeScale time_scale, PriceType price_type, Color color) { IReadOnlyList <PriceCandle> candles = price_set.GetCandles(time_scale); IReadOnlyList <double> time = price_set.Ticks; double[] signal = new double[candles.Count]; Parallel.For(0, candles.Count, index => { signal[index] = candles[index].GetPrice(price_type); }); AddSignal(line_plot_2d, time, signal, color); }
/// <summary> /// Rotates around a given pivot to a given angle in degrees over a specified duration /// </summary> /// <param name="transform"></param> /// <param name="pivot"></param> /// <param name="axis"></param> /// <param name="degrees"></param> /// <param name="duration"></param> /// <param name="timeScale"></param> /// <returns></returns> public static IEnumerator RotateAround(Transform transform, Vector3 pivot, Vector3 axis, float degrees, float duration, TimeScale timeScale = TimeScale.FixedDelta) { float angularSpeed = degrees / duration; float elapsed = 0f; System.Action <float> func = (float t) => { float time = timeScale.GetTime(); elapsed += time; if (elapsed >= duration) { time = time - (elapsed - duration); } float nextAngle = angularSpeed * time; transform.RotateAround(pivot, axis, nextAngle); }; if (duration <= 0f) { transform.RotateAround(pivot, axis, degrees); } else { yield return(Lerp(func, duration)); } }
void LoadTimeScale() { this.timeScale = GameObject.Find("TimeScale").GetComponent <TimeScale>(); }
public Refs(TimeScale ts) { this.ts = ts; }
private void initTimeScaleDictionary() { if (m_TimeScaleDictionary.Count != 0) { return; } string[] labels = {"Holocene Epoch", "Quaternary Period", "Cainozoic Era", "Cenozoic Era", "Phanerozoic Eon", "Upper Pleistocene Age", "Pleistocene Epoch", "Ionian Age", "Calabrian Age", "Gelasian Age", "Piacenzian Age", "Pliocene Epoch", "Neogene Period", "Zanclean Age", "Messinian Age", "Miocene Epoch", "Tortonian Age", "Serravallian Age", "Langhian Age", "Burdigalian Age", "Aquitanian Age", "Chattian Age", "Oligocene Epoch", "Palaeogene Period", "Rupelian Age", "Priabonian Age", "Eocene Epoch", "Bartonian Age", "Lutetian Age", "Ypresian Age", "Thanetian Age", "Palaeocene Epoch", "Selandian Age", "Danian Age", "Maastrichtian Age", "Upper Cretaceous Epoch", "Cretaceous Period", "Mesozoic Era", "Campanian Age", "Santonian Age", "Coniacian Age", "Turonian Age", "Cenomanian Age", "Albian Age", "Lower Cretaceous Epoch", "Aptian Age", "Barremian Age", "Hauterivian Age", "Valanginian Age", "Berriasian Age", "Tithonian Age", "Upper Jurassic Epoch", "Jurassic Period", "Kimmeridgian Age", "Oxfordian Age", "Callovian Age", "Middle Jurassic Epoch", "Bathonian Age", "Bajocian Age", "Aalenian Age", "Toarcian Age", "Lower Jurassic Epoch", "Pliensbachian Age", "Sinemurian Age", "Hettangian Age", "Rhaetian Age", "Upper Triassic Epoch", "Triassic Period", "Norian Age", "Carnian Age", "Ladinian Age", "Middle Triassic Epoch", "Anisian Age", "Olenekian Age", "Lower Triassic Epoch", "Induan Age", "Changhsingian Age", "Lopingian Epoch", "Permian Period", "Palaeozoic Era", "Wuchiapingian Age", "Guadalupian Epoch", "Wordian Age", "Roadian Age", "Capitanian Age", "Kungurian Age", "Cisuralian Epoch", "Artinskian Age", "Sakmarian Age", "Asselian Age", "Gzhelian Age", "Upper Pennsylvanian Epoch", "Pennsylvanian Sub-period", "Upper Mississippian Epoch", "Carboniferous Period", "Kasimovian Age", "Middle Pennsylvanian Epoch", "Moscovian Age", "Bashkirian Age", "Lower Pennsylvanian Epoch", "Serpukhovian Age", "Mississippian Sub-period", "Middle Mississippian Epoch", "Visean Age", "Lower Mississippian Epoch", "Tournaisian Age", "Famennian Age", "Upper Devonian Epoch", "Devonian Period", "Frasnian Age", "Givetian Age", "Middle Devonian Epoch", "Eifelian Age", "Emsian Age", "Lower Devonian Epcoh", "Pragian Age", "Lochkovian Age", "Pridoli Epoch", "Silurian Period", "Ludfordian Age", "Gorstian Age", "Ludlow Epoch", "Homerian Age", "Wenlock Epoch", "Sheinwoodian Age", "Telychian Age", "Llandovery Epoch", "Aeronian Age", "Rhuddanian Age", "Hirnantian Age", "Upper Ordovician Epoch", "Ordovician Period", "Katian Age", "Sandbian Age", "Darriwilian Age", "Middle Ordovician Epoch", "Dapingian Age", "Floian Age", "Lower Ordovician Epoch", "Tremadocian Age", "Cambrian Stage 10 Age", "Furongian Epoch", "Cambrian Period", "Cambrian Stage 9 Age", "Paibian Age", "Guzhangian Age", "Cambrian Series 3 Epoch", "Drumian Age", "Cambrian Stage 5 Age", "Cambrian Stage 4 Age", "Cambrian Series 2 Epoch", "Cambrian Stage 3 Age", "Cambrian Stage 2 Age", "Terreneuvian Epoch", "Fortunian Age", "Ediacaran Period", "Neoproterozoic Era", "Proterozoic Eon", "Precambrian Supereon", "Cryogenian Period", "Tonian Period", "Stenian Period", "Mesoproterozoic Era", "Ectasian Period", "Calymmian Period", "Statherian Period", "Palaeoproterozoic Era", "Orosirian Period", "Rhyacian Period", "Siderian Period", "Neoarchaean Era", "Archaean Eon", "Mesoarchaean Era", "Palaeoarchaean Era", "Eoarchaean Era", "Hadean Eon" }; double[] startTimes = {0.0117, 2.588, 65.5, 65.5, 542, 0.126, 2.588, 0.781, 1.806, 2.588, 3.6, 5.332, 23.02, 5.332, 7.246, 23.02, 11.608, 13.82, 15.97, 20.43, 23.02, 28.4, 33.9, 65.5, 33.9, 37.2, 55.8, 40.4, 48.6, 55.8, 58.7, 65.5, 61.1, 65.5, 70.6, 99.6, 145.5, 251, 83.5, 85.8, 89.3, 93.6, 99.6, 112, 145.5, 125, 130, 133.9, 140.2, 145.5, 150.8, 161.2, 199.6, 155.6, 161.2, 164.7, 175.6, 167.7, 171.6, 175.6, 183, 199.6, 189.6, 196.5, 199.6, 203.6, 228.7, 251, 216.5, 228.7, 237, 245.9, 245.9, 249.5, 251, 251, 253.8, 260.4, 299, 542, 260.4, 270.6, 268, 270.6, 265.8, 275.6, 299, 284.4, 294.6, 299, 303.4, 307.2, 318.1, 328.3, 359.2, 307.2, 311.7, 311.7, 318.1, 318.1, 328.3, 359.2, 345.3, 345.3, 359.2, 359.2, 374.5, 385.3, 416, 385.3, 391.8, 397.5, 397.5, 407, 416, 411.2, 416, 418.7, 443.7, 421.3, 422.9, 418.7, 426.2, 428.2, 428.2, 436, 443.7, 439, 443.7, 445.6, 460.9, 488.3, 455.8, 460.9, 468.1, 471.8, 471.8, 478.6, 488.3, 488.3, 492, 499, 542, 496, 499, 503, 510, 506.5, 510, 517, 521, 521, 528, 542, 542, 635, 1000, 2500, 9999.9999, 850, 1000, 1200, 1600, 1400, 1600, 1800, 2500, 2050, 2300, 2500, 2800, 4000, 3200, 3600, 4000, 9999.9999}; double[] endTimes = {0, 0, 0, 0, 0, 0.0117, 0.0117, 0.126, 0.781, 1.806, 2.588, 2.588, 2.588, 3.6, 5.332, 5.332, 7.246, 11.608, 13.82, 15.97, 20.43, 23.02, 23.02, 23.02, 28.4, 33.9, 33.9, 37.2, 40.4, 48.6, 55.8, 55.8, 58.7, 61.1, 65.5, 65.5, 65.5, 65.5, 70.6, 83.5, 85.8, 89.3, 93.6, 99.6, 99.6, 112, 125, 130, 133.9, 140.2, 145.5, 145.5, 145.5, 150.8, 155.6, 161.2, 161.2, 164.7, 167.7, 171.6, 175.6, 175.6, 183, 189.6, 196.5, 199.6, 199.6, 199.6, 203.6, 216.5, 228.7, 228.7, 237, 245.9, 245.9, 249.5, 251, 251, 251, 251, 253.8, 260.4, 265.8, 268, 270.6, 270.6, 270.6, 275.6, 284.4, 294.6, 299, 299, 299, 299, 299, 303.4, 307.2, 307.2, 311.7, 311.7, 318.1, 318.1, 328.3, 328.3, 345.3, 345.3, 359.2, 359.2, 359.2, 374.5, 385.3, 385.3, 391.8, 397.5, 397.5, 407, 411.2, 416, 416, 418.7, 421.3, 422.9, 422.9, 422.9, 426.2, 428.2, 428.2, 436, 439, 443.7, 443.7, 443.7, 445.6, 455.8, 460.9, 460.9, 468.1, 471.8, 471.8, 478.6, 488.3, 488.3, 488.3, 492, 496, 499, 499, 503, 506.5, 510, 510, 517, 521, 521, 528, 542, 542, 542, 542, 635, 850, 1000, 1000, 1200, 1400, 1600, 1600, 1800, 2050, 2300, 2500, 2500, 2800, 3200, 3600, 4000}; for (int i = 0; i < labels.Length; i++) { TimeScale aTimeScale = new TimeScale(); aTimeScale.label = labels[i]; aTimeScale.startTime = startTimes[i]; aTimeScale.endTime = endTimes[i]; m_TimeScaleDictionary.Add(aTimeScale.label, aTimeScale); } }
public CoroutineInterval(Duration duration, TimeScale timeScale = TimeScale.Unity) : this(duration, timeScale.asContext()) { }
void Awake() { instance = this; timeScale = TimeScale.ONE; Time.timeScale = 0f; isPlaying = false; }
private static List <PriceCandle> ReadHST400(BinaryReader reader, long file_size, TimeScale time_scale, double spread) { // bars array(single-byte justification) . . . total 44 bytes long line_count = (file_size - 148) / 44; List <PriceCandle> data = new List <PriceCandle>(); for (int i = 0; i < line_count; i++) { reader.ReadBytes(4); DateTimeUTC open_date_time = ToolsTime.UnixTimeStampToDateTimeUTC(reader.ReadInt32()); double open = reader.ReadDouble(); // open price 8 bytes double low = reader.ReadDouble(); // lowest price 8 bytes double high = reader.ReadDouble(); // highest price 8 bytes double close = reader.ReadDouble(); // close price 8 bytes double volume = reader.ReadDouble(); // tick count 8 bytes data.Add(new PriceCandle(open_date_time, time_scale, open, high, low, close, volume, spread)); } return(data); }
private static List <PriceCandle> ReadHST401(BinaryReader reader, long file_size, TimeScale time_scale) { //then the bars array(single-byte justification) . . . total 60 bytes long line_count = (file_size - 148) / 60; List <PriceCandle> data = new List <PriceCandle>(); for (int i = 0; i < line_count; i++) { DateTimeUTC open_date_time = ToolsTime.UnixTimeStampToDateTimeUTC(reader.ReadInt64()); // bar start time 8 bytes double open = reader.ReadDouble(); // open price 8 bytes double high = reader.ReadDouble(); // highest price 8 bytes double low = reader.ReadDouble(); // lowest price 8 bytes double close = reader.ReadDouble(); // close price 8 bytes long volume = reader.ReadInt64(); // tick count 8 bytes int spread = reader.ReadInt32();; // spread 4 bytes long real_volume = reader.ReadInt64(); // real volume 8 bytes data.Add(new PriceCandle(open_date_time, time_scale, open, high, low, close, volume, spread, real_volume)); } return(data); }
public StratusActionSequence(TimeScale mode = TimeScale.Delta) : base(mode) { }
// Use this for initialization void Start () { timeScale = new TimeScale(); }
public RobustHistogram(TimeScale scale) { this.Clear(); this.Scale = scale; this.TicksToUnit = GetScaleToTicksRatio(scale); }