예제 #1
0
        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;
            }
        }
예제 #2
0
 public WickoArgs(Wicko wicko)
 {
     Wicko = wicko;
 }
예제 #3
0
        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();
                    }
                }
            }
        }