Пример #1
0
        void PlotChart()
        {
            if (Showtotalvolume)
            {
                TotalVolume.Set(totalvolume);
            }

            if (deltamode)
            {
                if (deltavolume > 0)
                {
                    UpVolume.Set(deltavolume);
                    DownVolume.Set(0);
                }
                else if (deltavolume < 0)
                {
                    UpVolume.Set(0);
                    DownVolume.Set((revneg) ? deltavolume : -deltavolume);
                }
                else
                {
                    UpVolume.Set(0);
                    DownVolume.Set(0);
                }
            }
            else
            {
                UpVolume.Set(upvolume);
                DownVolume.Set(downvolume);
            }
        }
Пример #2
0
 protected override void OnBarUpdate()
 {
     if (Close[0] >= Open[0])
     {
         UpVolume[0] = Volume[0];
         DownVolume.Reset();
     }
     else
     {
         UpVolume.Reset();
         DownVolume[0] = Volume[0];
     }
 }
Пример #3
0
 protected override void OnBarUpdate()
 {
     if (Close[0] >= Open[0])
     {
         UpVolume[0] = Instrument.MasterInstrument.InstrumentType == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[0]) : Volume[0];
         DownVolume.Reset();
     }
     else
     {
         UpVolume.Reset();
         DownVolume[0] = Instrument.MasterInstrument.InstrumentType == InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume((long)Volume[0]) : Volume[0];
     }
 }
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 17;
                hash = hash * 29 + RequestId != null?RequestId.GetHashCode() : 0;

                hash = hash * 29 + Symbol.GetHashCode();
                hash = hash * 29 + ExchangeId.GetHashCode();
                hash = hash * 29 + SecurityType.GetHashCode();
                hash = hash * 29 + (Last.HasValue ? Last.GetHashCode() : 0);
                hash = hash * 29 + (TradeSize.HasValue ? TradeSize.GetHashCode() : 0);
                hash = hash * 29 + (TradedMarket.HasValue ? TradedMarket.GetHashCode() : 0);
                hash = hash * 29 + (TradeDate.HasValue ? TradeDate.GetHashCode() : 0);
                hash = hash * 29 + (TradeTime.HasValue ? TradeTime.GetHashCode() : 0);
                hash = hash * 29 + (Open.HasValue ? Open.GetHashCode() : 0);
                hash = hash * 29 + (High.HasValue ? High.GetHashCode() : 0);
                hash = hash * 29 + (Low.HasValue ? Low.GetHashCode() : 0);
                hash = hash * 29 + (Close.HasValue ? Close.GetHashCode() : 0);
                hash = hash * 29 + (Bid.HasValue ? Bid.GetHashCode() : 0);
                hash = hash * 29 + (BidMarket.HasValue ? BidMarket.GetHashCode() : 0);
                hash = hash * 29 + (BidSize.HasValue ? BidSize.GetHashCode() : 0);
                hash = hash * 29 + (Ask.HasValue ? Ask.GetHashCode() : 0);
                hash = hash * 29 + (AskMarket.HasValue ? AskMarket.GetHashCode() : 0);
                hash = hash * 29 + (AskSize.HasValue ? AskSize.GetHashCode() : 0);
                hash = hash * 29 + (Volume.HasValue ? Volume.GetHashCode() : 0);
                hash = hash * 29 + (PDayVolume.HasValue ? PDayVolume.GetHashCode() : 0);
                hash = hash * 29 + (UpVolume.HasValue ? UpVolume.GetHashCode() : 0);
                hash = hash * 29 + (DownVolume.HasValue ? DownVolume.GetHashCode() : 0);
                hash = hash * 29 + (NeutralVolume.HasValue ? NeutralVolume.GetHashCode() : 0);
                hash = hash * 29 + (TradeCount.HasValue ? TradeCount.GetHashCode() : 0);
                hash = hash * 29 + (UpTrades.HasValue ? UpTrades.GetHashCode() : 0);
                hash = hash * 29 + (DownTrades.HasValue ? DownTrades.GetHashCode() : 0);
                hash = hash * 29 + (NeutralTrades.HasValue ? NeutralTrades.GetHashCode() : 0);
                hash = hash * 29 + (VWAP.HasValue ? VWAP.GetHashCode() : 0);
                hash = hash * 29 + (MutualDiv.HasValue ? MutualDiv.GetHashCode() : 0);
                hash = hash * 29 + (SevenDayYield.HasValue ? SevenDayYield.GetHashCode() : 0);
                hash = hash * 29 + (OpenInterest.HasValue ? OpenInterest.GetHashCode() : 0);
                hash = hash * 29 + (Settlement.HasValue ? Settlement.GetHashCode() : 0);
                hash = hash * 29 + (SettlementDate.HasValue ? SettlementDate.GetHashCode() : 0);
                hash = hash * 29 + (ExpirationDate.HasValue ? ExpirationDate.GetHashCode() : 0);
                hash = hash * 29 + (Strike.HasValue ? Strike.GetHashCode() : 0);
                return(hash);
            }
        }
Пример #5
0
        void PlotChart()
        {
            if (CurrentBar < 1)
            {
                return;
            }

            if (deltavolume > 0)
            {
                UpVolume.Set(deltavolume);
                DownVolume.Set(0);

                if (textWarnings)
                {
                    if (Values[0][0] >= (multiplier * Values[0][1]) && Values[0][0] >= HighVolume && Values[0][1] > 0)
                    {
                        DrawText("Delta" + CurrentBar, true, Convert.ToString("v ") + Convert.ToString(Values[0][0]) + " ~↑ " + Close[0], 0, Low[0] - textOffset * TickSize, 0, textColor1,
                                 textFont, StringAlignment.Center, outlineColor1, areaColor1, zopacity1);
                    }

                    else
                    {
                        DrawText("Delta" + CurrentBar, true, Convert.ToString("NEUTRAL"), 0, Low[0] - textOffset * TickSize, 0, Color.Transparent,
                                 textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                    }
                }

                if (alertBox)
                {
                    if (Values[0][0] >= (multiplier * Values[0][1]) && Values[0][0] >= HighVolume && Values[0][1] > 0)
                    {
                        DrawTextFixed("AlertBox", (Instrument.MasterInstrument.Name) + " " + Convert.ToString(Values[0][1]) + " to" + Convert.ToString(Values[0][0]) + " @   " + Close[0], tpos, textColor3, textFont1, outlineColor3, areaColor3, zopacity3);
                    }

                    else
                    {
                        DrawTextFixed("AlertBox", "Alert", tpos, Color.Transparent, textFont1, Color.Transparent, Color.Transparent, 0);
                    }
                }

                if (SoundAlert)
                {
                    if (Values[0][0] >= (multiplier * Values[0][1]) && Values[0][0] >= HighVolume && Values[0][1] > 0)
                    {
                        try
                        {
                            Alert("Delta", NinjaTrader.Cbi.Priority.Medium, "DeltaX UP " + Bars.Period.Value + " Period" + " " + Convert.ToString(Values[0][1]) + " to " + Convert.ToString(Values[0][0]) + " @ " + Close[0], upFile, rearmTime, Color.Gold, Color.Navy);
                        }
                        catch {}
                    }
                }
            }

            else if (deltavolume < 0)
            {
                UpVolume.Set(0);
                DownVolume.Set(-deltavolume);

                if (textWarnings)
                {
                    if (Values[1][0] >= (multiplier * Values[1][1]) && Values[1][0] >= HighVolume && Values[1][1] > 0)
                    {
                        DrawText("Delta" + CurrentBar, true, Convert.ToString("v ") + Convert.ToString(Values[1][0]) + " ~↓ " + Close[0], 0, High[0] + textOffset * TickSize, 0, textColor2,
                                 textFont, StringAlignment.Center, outlineColor2, areaColor2, zopacity2);
                    }

                    else
                    {
                        DrawText("Delta" + CurrentBar, true, Convert.ToString("NEUTRAL"), 0, High[0] + textOffset * TickSize, 0, Color.Transparent,
                                 textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                    }
                }

                if (AlertBox)
                {
                    if (Values[1][0] >= (multiplier * Values[1][1]) && Values[1][0] >= HighVolume && Values[1][1] > 0)
                    {
                        DrawTextFixed("AlertBox", (Instrument.MasterInstrument.Name) + "   " + Convert.ToString(Values[1][0]) + " @   " + Close[0], tpos, textColor4, textFont1, outlineColor4, areaColor4, zopacity4);
                    }

                    else
                    {
                        DrawTextFixed("AlertBox", "Alert", tpos, Color.Transparent, textFont1, Color.Transparent, Color.Transparent, 0);
                    }
                }

                if (SoundAlert)
                {
                    if (Values[1][0] >= (multiplier * Values[1][1]) && Values[1][0] >= HighVolume && Values[1][1] > 0)
                    {
                        try
                        {
                            Alert("Delta", NinjaTrader.Cbi.Priority.Medium, "DeltaX DOWN " + Bars.Period.Value + " Period" + " " + Convert.ToString(Values[1][1]) + " to " + Convert.ToString(Values[1][0]) + " @ " + Close[0], downFile, rearmTime, Color.Plum, Color.Red);
                        }
                        catch {}
                    }
                }
            }
        }
Пример #6
0
        void PlotChart()
        {
            if (deltavolume > 0)
            {
                UpVolume.Set(deltavolume);
                DownVolume.Set(0);

                if (textWarnings)
                {
                    if (Close[0] < Open[0])
                    {
                        DrawText("Delta" + CurrentBar, true, Convert.ToString(plotAlert), 0, High[0] + textOffset * TickSize, 0, textColor1,
                                 textFont, StringAlignment.Center, outlineColor1, areaColor1, Zopacity1);
                    }

                    else if (Close[0] >= Open[0])
                    {
                        DrawText("Delta" + CurrentBar, true, Convert.ToString("NEUTRAL"), 0, High[0] + textOffset * TickSize, 0, Color.Transparent,
                                 textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                    }
                }

                if (SoundAlert)
                {
                    if (Close[0] < Open[0])
                    {
                        try
                        {
                            Alert("Delta", NinjaTrader.Cbi.Priority.Medium, "Div Down " + Bars.Period.Value + " " + Values[0] + " " + CurrentBar, downFile, rearmTime, Color.Navy, Color.Magenta);
                        }
                        catch {}
                    }
                }
            }

            else if (deltavolume < 0)
            {
                UpVolume.Set(0);
                DownVolume.Set(-deltavolume);

                if (textWarnings)
                {
                    if (Close[0] > Open[0])
                    {
                        DrawText("Delta" + CurrentBar, true, Convert.ToString(plotAlert), 0, Low[0] - textOffset * TickSize, 0, textColor2,
                                 textFont, StringAlignment.Center, outlineColor2, areaColor2, Zopacity2);
                    }

                    else if (Close[0] <= Open[0])
                    {
                        DrawText("Delta" + CurrentBar, true, Convert.ToString("NEUTRAL"), 0, Low[0] - textOffset * TickSize, 0, Color.Transparent,
                                 textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                    }
                }

                if (SoundAlert)
                {
                    if (Close[0] > Open[0])
                    {
                        try
                        {
                            Alert("Delta", NinjaTrader.Cbi.Priority.Medium, "Div Up " + Bars.Period.Value + " " + Values[0] + " " + CurrentBar, upFile, rearmTime, Color.Navy, Color.Magenta);
                        }
                        catch {}
                    }
                }
            }
        }