private void Falling() { double limit; while (closeRate < (limit = (openRate - wickoSize) .ToRoundedRate(Symbol))) { var wicko = GetNewWicko( openRate, highRate, limit, limit); lastWicko = wicko; OnWicko?.Invoke(this, new WickoArgs(wicko)); openOn = closeOn; openRate = limit; highRate = limit; } }
public WickoArgs(Wicko wicko) { Wicko = wicko; }
public void HandleTick(Tick tick) { var rate = tick.ToRate(rateToUse); if (firstTick) { firstTick = false; openOn = tick.TickOn; closeOn = tick.TickOn; openRate = rate; highRate = rate; lowRate = rate; closeRate = rate; } else { closeOn = tick.TickOn; if (rate > highRate) { highRate = rate; } if (rate < lowRate) { lowRate = rate; } closeRate = rate; if (closeRate > openRate) { if (lastWicko == null || (lastWicko.Trend == Trend.Rising)) { Rising(); return; } var limit = (lastWicko.OpenRate + wickoSize) .ToRoundedRate(Symbol); if (closeRate > limit) { var wicko = GetNewWicko( lastWicko.OpenRate, limit, lowRate, limit); lastWicko = wicko; OnWicko?.Invoke(this, new WickoArgs(wicko)); openOn = closeOn; openRate = limit; lowRate = limit; Rising(); } } else if (closeRate < openRate) { if (lastWicko == null || (lastWicko.Trend == Trend.Falling)) { Falling(); return; } var limit = (lastWicko.OpenRate - wickoSize) .ToRoundedRate(Symbol); if (closeRate < limit) { var wicko = GetNewWicko( lastWicko.OpenRate, highRate, limit, limit); lastWicko = wicko; OnWicko?.Invoke(this, new WickoArgs(wicko)); openOn = closeOn; openRate = limit; highRate = limit; Falling(); } } } }