private void Falling() { double limit; while (closePrice < (limit = Asset.Round(openPrice - wickoSize))) { var wicko = GetNewWicko( openPrice, highPrice, limit, limit); lastWicko = wicko; OnWicko?.Invoke(this, new WickoArgs(wicko)); openOn = closeOn; openPrice = limit; highPrice = limit; } }
public WickoArgs(Wicko wicko) { Wicko = wicko; }
public void HandleTick(BidAsk bidAsk) { if (firstTick) { firstTick = false; openOn = bidAsk.TickOnEst; closeOn = bidAsk.TickOnEst; openPrice = bidAsk.MidPrice; highPrice = bidAsk.MidPrice; lowPrice = bidAsk.MidPrice; closePrice = bidAsk.MidPrice; } else { closeOn = bidAsk.TickOnEst; if (bidAsk.MidPrice > highPrice) { highPrice = bidAsk.MidPrice; } if (bidAsk.MidPrice < lowPrice) { lowPrice = bidAsk.MidPrice; } closePrice = bidAsk.MidPrice; if (closePrice > openPrice) { if (lastWicko == null || (lastWicko.Trend == Trend.Rising)) { Rising(); return; } var limit = Asset.Round(lastWicko.OpenPrice + wickoSize); if (closePrice > limit) { var wicko = GetNewWicko( lastWicko.OpenPrice, limit, lowPrice, limit); lastWicko = wicko; OnWicko?.Invoke(this, new WickoArgs(wicko)); openOn = closeOn; openPrice = limit; lowPrice = limit; Rising(); } } else if (closePrice < openPrice) { if (lastWicko == null || (lastWicko.Trend == Trend.Falling)) { Falling(); return; } var limit = Asset.Round(lastWicko.OpenPrice - wickoSize); if (closePrice < limit) { var wicko = GetNewWicko( lastWicko.OpenPrice, highPrice, limit, limit); lastWicko = wicko; OnWicko?.Invoke(this, new WickoArgs(wicko)); openOn = closeOn; openPrice = limit; highPrice = limit; Falling(); } } } }