Ejemplo n.º 1
0
        public Indicator.GomCD GomCD(GomCDCalculationModeType calcMode, GomCDChartType chart, string fileFormat, Gom.FileModeType fileModeType, GomFilterModeType filterMode, int filterSize, bool reinitSession)
        {
            Indicator.GomCD indy = _indicator.GomCD(calcMode, chart, fileFormat, filterMode, filterSize, reinitSession);
            indy.FileMode = fileModeType;

            return(indy);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gom Cumulative Delta
        /// </summary>
        /// <returns></returns>
        public Indicator.GomCD GomCD(Data.IDataSeries input, GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession)
        {
            if (InInitialize && input == null)
            {
                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
            }

            return(_indicator.GomCD(input, calcMode, chart, reinitSession));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gom Cumulative Delta
        /// </summary>
        /// <returns></returns>
        public GomCD GomCD(Data.IDataSeries input, GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession)
        {
            if (cacheGomCD != null)
            {
                for (int idx = 0; idx < cacheGomCD.Length; idx++)
                {
                    if (cacheGomCD[idx].CalcMode == calcMode && cacheGomCD[idx].Chart == chart && cacheGomCD[idx].reinitSession == reinitSession && cacheGomCD[idx].EqualsInput(input))
                    {
                        return(cacheGomCD[idx]);
                    }
                }
            }

            lock (checkGomCD)
            {
                checkGomCD.CalcMode = calcMode;
                calcMode            = checkGomCD.CalcMode;
                checkGomCD.Chart    = chart;
                chart = checkGomCD.Chart;
                checkGomCD.reinitSession = reinitSession;
                reinitSession            = checkGomCD.reinitSession;

                if (cacheGomCD != null)
                {
                    for (int idx = 0; idx < cacheGomCD.Length; idx++)
                    {
                        if (cacheGomCD[idx].CalcMode == calcMode && cacheGomCD[idx].Chart == chart && cacheGomCD[idx].reinitSession == reinitSession && cacheGomCD[idx].EqualsInput(input))
                        {
                            return(cacheGomCD[idx]);
                        }
                    }
                }

                GomCD indicator = new GomCD();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.CalcMode      = calcMode;
                indicator.Chart         = chart;
                indicator.reinitSession = reinitSession;
                Indicators.Add(indicator);
                indicator.SetUp();

                GomCD[] tmp = new GomCD[cacheGomCD == null ? 1 : cacheGomCD.Length + 1];
                if (cacheGomCD != null)
                {
                    cacheGomCD.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheGomCD          = tmp;
                return(indicator);
            }
        }
Ejemplo n.º 4
0
        public GomCD GomCD(GomCDCalculationModeType calcMode, GomCDChartType chart, string fileFormat, GomFilterModeType filterMode, int filterSize, bool reinitSession)
        {
            GomCD indy = GomCD(Input, calcMode, chart, reinitSession);

            indy.FileFormat = fileFormat;
            indy.FilterMode = filterMode;
            indy.FilterSize = filterSize;


            return(indy);
        }
Ejemplo n.º 5
0
        private int CalcDelta(TickTypeEnum tickType, double price, int volume, GomCDCalculationModeType calcmode, bool backupmode, int filtersize, GomFilterModeType filtermode)
        {
            int delta     = 0;
            int direction = lastdirection;


            if ((calcmode == GomCDCalculationModeType.BidAsk) && (tickType != TickTypeEnum.Unknown) && (tickType != TickTypeEnum.BetweenBidAsk))
            {
                if ((tickType == TickTypeEnum.BelowBid) || (tickType == TickTypeEnum.AtBid))
                {
                    delta = -volume;
                }
                else if ((tickType == TickTypeEnum.AboveAsk) || (tickType == TickTypeEnum.AtAsk))
                {
                    delta = volume;
                }
            }
            else if (calcmode == GomCDCalculationModeType.UpDownTick)
            {
                if (lastprice != 0)
                {
                    if (price > lastprice)
                    {
                        delta = volume;
                    }
                    if (price < lastprice)
                    {
                        delta = -volume;
                    }
                }
            }
            else if ((calcmode == GomCDCalculationModeType.UpDownTickWithContinuation) || ((calcmode == GomCDCalculationModeType.BidAsk) && (backupmode == true)))
            {
                if (price > lastprice)                  //normal uptick/dn tick
                {
                    direction = 1;
                }
                else if (price < lastprice)
                {
                    direction = -1;
                }

                delta = direction * volume;
            }

            // added

            else if ((calcmode == GomCDCalculationModeType.Hybrid))
            {
                if (price > lastprice)                  //normal uptick/dn tick
                {
                    direction = 1;
                    //price changed, we reinit the startlookingforreversal bool.
                    startlookingforreversal = false;
                }
                else if (price < lastprice)
                {
                    direction = -1;
                    startlookingforreversal = false;
                }


                if (!startlookingforreversal)
                {
                    if (direction == 1)
                    {
                        //if going up, we want to be hitting bid to be able to start to spot reversals (hitting the ask)
                        startlookingforreversal = (tickType == TickTypeEnum.AtBid) || (tickType == TickTypeEnum.BelowBid);
                    }
                    else
                    {
                        startlookingforreversal = (tickType == TickTypeEnum.AtAsk) || (tickType == TickTypeEnum.AboveAsk);
                    }
                }

                //what happens when price is same
                if (price == lastprice)
                {
                    //if going up, and we have already hit the bid (startlookingforreversal is true) at a price level,
                    // and start hitting the ask, let's reverse

                    if ((direction == 1) && startlookingforreversal && ((tickType == TickTypeEnum.AtAsk) || (tickType == TickTypeEnum.BetweenBidAsk)))
                    {
                        direction = -1;
                    }

                    else if ((direction == -1) && startlookingforreversal && ((tickType == TickTypeEnum.AtBid) || (tickType == TickTypeEnum.BetweenBidAsk)))
                    {
                        direction = 1;                          //buyers take control of ask
                    }
                }


                delta = direction * volume;
            }

            lastprice     = price;
            lastdirection = direction;

            if ((filtermode == GomFilterModeType.OnlyLargerThan) && (volume <= filtersize))
            {
                delta = 0;
            }

            if ((filtermode == GomFilterModeType.OnlySmallerThan) && (volume >= filtersize))
            {
                delta = 0;
            }

            return(delta);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Base Class. Do not instantiate
        /// </summary>
        /// <returns></returns>
        public Indicator.GomDeltaIndicator GomDeltaIndicator(Data.IDataSeries input, bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize)
        {
            if (InInitialize && input == null)
            {
                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
            }

            return(_indicator.GomDeltaIndicator(input, backupMode, calcMode, filterMode, filterSize));
        }
Ejemplo n.º 7
0
 public Indicator.GomDeltaIndicator GomDeltaIndicator(bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize)
 {
     return(_indicator.GomDeltaIndicator(Input, backupMode, calcMode, filterMode, filterSize));
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Base Class. Do not instantiate
        /// </summary>
        /// <returns></returns>
        public GomDeltaIndicator GomDeltaIndicator(Data.IDataSeries input, bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize)
        {
            if (cacheGomDeltaIndicator != null)
            {
                for (int idx = 0; idx < cacheGomDeltaIndicator.Length; idx++)
                {
                    if (cacheGomDeltaIndicator[idx].BackupMode == backupMode && cacheGomDeltaIndicator[idx].CalcMode == calcMode && cacheGomDeltaIndicator[idx].FilterMode == filterMode && cacheGomDeltaIndicator[idx].FilterSize == filterSize && cacheGomDeltaIndicator[idx].EqualsInput(input))
                    {
                        return(cacheGomDeltaIndicator[idx]);
                    }
                }
            }

            lock (checkGomDeltaIndicator)
            {
                checkGomDeltaIndicator.BackupMode = backupMode;
                backupMode = checkGomDeltaIndicator.BackupMode;
                checkGomDeltaIndicator.CalcMode = calcMode;
                calcMode = checkGomDeltaIndicator.CalcMode;
                checkGomDeltaIndicator.FilterMode = filterMode;
                filterMode = checkGomDeltaIndicator.FilterMode;
                checkGomDeltaIndicator.FilterSize = filterSize;
                filterSize = checkGomDeltaIndicator.FilterSize;

                if (cacheGomDeltaIndicator != null)
                {
                    for (int idx = 0; idx < cacheGomDeltaIndicator.Length; idx++)
                    {
                        if (cacheGomDeltaIndicator[idx].BackupMode == backupMode && cacheGomDeltaIndicator[idx].CalcMode == calcMode && cacheGomDeltaIndicator[idx].FilterMode == filterMode && cacheGomDeltaIndicator[idx].FilterSize == filterSize && cacheGomDeltaIndicator[idx].EqualsInput(input))
                        {
                            return(cacheGomDeltaIndicator[idx]);
                        }
                    }
                }

                GomDeltaIndicator indicator = new GomDeltaIndicator();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input      = input;
                indicator.BackupMode = backupMode;
                indicator.CalcMode   = calcMode;
                indicator.FilterMode = filterMode;
                indicator.FilterSize = filterSize;
                Indicators.Add(indicator);
                indicator.SetUp();

                GomDeltaIndicator[] tmp = new GomDeltaIndicator[cacheGomDeltaIndicator == null ? 1 : cacheGomDeltaIndicator.Length + 1];
                if (cacheGomDeltaIndicator != null)
                {
                    cacheGomDeltaIndicator.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]    = indicator;
                cacheGomDeltaIndicator = tmp;
                return(indicator);
            }
        }
Ejemplo n.º 9
0
		public Indicator.GomCD GomCD(GomCDCalculationModeType calcMode, GomCDChartType chart, string fileFormat, Gom.FileModeType fileModeType,GomFilterModeType filterMode, int filterSize, bool reinitSession)
        {
            Indicator.GomCD indy = _indicator.GomCD(calcMode,chart,fileFormat,filterMode,filterSize,reinitSession);
			indy.FileMode=fileModeType;

            return indy;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Base Class. Do not instantiate
        /// </summary>
        /// <returns></returns>
        public Indicator.GomDeltaIndicator GomDeltaIndicator(Data.IDataSeries input, bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize)
        {
            if (InInitialize && input == null)
                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

            return _indicator.GomDeltaIndicator(input, backupMode, calcMode, filterMode, filterSize);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Gom Cumulative Delta
        /// </summary>
        /// <returns></returns>
        public Indicator.GomCD GomCD(Data.IDataSeries input, GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession)
        {
            if (InInitialize && input == null)
                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

            return _indicator.GomCD(input, calcMode, chart, reinitSession);
        }
Ejemplo n.º 12
0
 public Indicator.GomCD GomCD(GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession)
 {
     return _indicator.GomCD(Input, calcMode, chart, reinitSession);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Gom Cumulative Delta
 /// </summary>
 /// <returns></returns>
 public Indicator.GomCD GomCD(Data.IDataSeries input, GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession)
 {
     return _indicator.GomCD(input, calcMode, chart, reinitSession);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Gom Cumulative Delta
        /// </summary>
        /// <returns></returns>
        public GomCD GomCD(Data.IDataSeries input, GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession)
        {
            if (cacheGomCD != null)
                for (int idx = 0; idx < cacheGomCD.Length; idx++)
                    if (cacheGomCD[idx].CalcMode == calcMode && cacheGomCD[idx].Chart == chart && cacheGomCD[idx].reinitSession == reinitSession && cacheGomCD[idx].EqualsInput(input))
                        return cacheGomCD[idx];

            lock (checkGomCD)
            {
                checkGomCD.CalcMode = calcMode;
                calcMode = checkGomCD.CalcMode;
                checkGomCD.Chart = chart;
                chart = checkGomCD.Chart;
                checkGomCD.reinitSession = reinitSession;
                reinitSession = checkGomCD.reinitSession;

                if (cacheGomCD != null)
                    for (int idx = 0; idx < cacheGomCD.Length; idx++)
                        if (cacheGomCD[idx].CalcMode == calcMode && cacheGomCD[idx].Chart == chart && cacheGomCD[idx].reinitSession == reinitSession && cacheGomCD[idx].EqualsInput(input))
                            return cacheGomCD[idx];

                GomCD indicator = new GomCD();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.CalcMode = calcMode;
                indicator.Chart = chart;
                indicator.reinitSession = reinitSession;
                Indicators.Add(indicator);
                indicator.SetUp();

                GomCD[] tmp = new GomCD[cacheGomCD == null ? 1 : cacheGomCD.Length + 1];
                if (cacheGomCD != null)
                    cacheGomCD.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheGomCD = tmp;
                return indicator;
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Base Class. Do not instantiate
        /// </summary>
        /// <returns></returns>
        public GomDeltaIndicator GomDeltaIndicator(Data.IDataSeries input, bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize)
        {
            if (cacheGomDeltaIndicator != null)
                for (int idx = 0; idx < cacheGomDeltaIndicator.Length; idx++)
                    if (cacheGomDeltaIndicator[idx].BackupMode == backupMode && cacheGomDeltaIndicator[idx].CalcMode == calcMode && cacheGomDeltaIndicator[idx].FilterMode == filterMode && cacheGomDeltaIndicator[idx].FilterSize == filterSize && cacheGomDeltaIndicator[idx].EqualsInput(input))
                        return cacheGomDeltaIndicator[idx];

            lock (checkGomDeltaIndicator)
            {
                checkGomDeltaIndicator.BackupMode = backupMode;
                backupMode = checkGomDeltaIndicator.BackupMode;
                checkGomDeltaIndicator.CalcMode = calcMode;
                calcMode = checkGomDeltaIndicator.CalcMode;
                checkGomDeltaIndicator.FilterMode = filterMode;
                filterMode = checkGomDeltaIndicator.FilterMode;
                checkGomDeltaIndicator.FilterSize = filterSize;
                filterSize = checkGomDeltaIndicator.FilterSize;

                if (cacheGomDeltaIndicator != null)
                    for (int idx = 0; idx < cacheGomDeltaIndicator.Length; idx++)
                        if (cacheGomDeltaIndicator[idx].BackupMode == backupMode && cacheGomDeltaIndicator[idx].CalcMode == calcMode && cacheGomDeltaIndicator[idx].FilterMode == filterMode && cacheGomDeltaIndicator[idx].FilterSize == filterSize && cacheGomDeltaIndicator[idx].EqualsInput(input))
                            return cacheGomDeltaIndicator[idx];

                GomDeltaIndicator indicator = new GomDeltaIndicator();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.BackupMode = backupMode;
                indicator.CalcMode = calcMode;
                indicator.FilterMode = filterMode;
                indicator.FilterSize = filterSize;
                Indicators.Add(indicator);
                indicator.SetUp();

                GomDeltaIndicator[] tmp = new GomDeltaIndicator[cacheGomDeltaIndicator == null ? 1 : cacheGomDeltaIndicator.Length + 1];
                if (cacheGomDeltaIndicator != null)
                    cacheGomDeltaIndicator.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheGomDeltaIndicator = tmp;
                return indicator;
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Gom Cumulative Delta
 /// </summary>
 /// <returns></returns>
 public Indicator.GomCD GomCD(Data.IDataSeries input, GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession)
 {
     return(_indicator.GomCD(input, calcMode, chart, reinitSession));
 }
Ejemplo n.º 17
0
 public Indicator.GomDeltaIndicator GomDeltaIndicator(bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize)
 {
     return _indicator.GomDeltaIndicator(Input, backupMode, calcMode, filterMode, filterSize);
 }
Ejemplo n.º 18
0
 public Indicator.GomCD GomCD(GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession)
 {
     return(_indicator.GomCD(Input, calcMode, chart, reinitSession));
 }
Ejemplo n.º 19
0
		private int CalcDelta(TickTypeEnum tickType, double price, int volume, GomCDCalculationModeType calcmode, bool backupmode, int filtersize, GomFilterModeType filtermode)
		{
			int delta = 0;
			int direction = lastdirection;


			if ((calcmode == GomCDCalculationModeType.BidAsk) && (tickType != TickTypeEnum.Unknown) && (tickType != TickTypeEnum.BetweenBidAsk))
			{
				if ((tickType == TickTypeEnum.BelowBid) || (tickType == TickTypeEnum.AtBid))
					delta = -volume;
				else if ((tickType == TickTypeEnum.AboveAsk) || (tickType == TickTypeEnum.AtAsk))
					delta = volume;
			}
			else if (calcmode == GomCDCalculationModeType.UpDownTick)
			{
				if (lastprice != 0)
				{
					if (price > lastprice) delta = volume;
					if (price < lastprice) delta = -volume;
				}
			}
			else if ((calcmode == GomCDCalculationModeType.UpDownTickWithContinuation) ||(calcmode == GomCDCalculationModeType.UpDownOneTickWithContinuation)|| ((calcmode == GomCDCalculationModeType.BidAsk) && (backupmode == true)))
			{
				if (price > lastprice)  //normal uptick/dn tick
					direction = 1;
				else if (price < lastprice)
					direction = -1;

				if (calcmode == GomCDCalculationModeType.UpDownOneTickWithContinuation)
					delta=direction;
				else
					delta = direction * volume;
			}

			// added	

			else if ((calcmode == GomCDCalculationModeType.Hybrid))
			{

				if (price > lastprice)  //normal uptick/dn tick
				{
					direction = 1;
					//price changed, we reinit the startlookingforreversal bool.
					startlookingforreversal = false;
				}
				else if (price < lastprice)
				{
					direction = -1;
					startlookingforreversal = false;
				}


				if (!startlookingforreversal)
					if (direction == 1)
						//if going up, we want to be hitting bid to be able to start to spot reversals (hitting the ask)
						startlookingforreversal = (tickType == TickTypeEnum.AtBid) || (tickType == TickTypeEnum.BelowBid);
					else
						startlookingforreversal = (tickType == TickTypeEnum.AtAsk) || (tickType == TickTypeEnum.AboveAsk);

				//what happens when price is same
				if (price == lastprice)
				{
					//if going up, and we have already hit the bid (startlookingforreversal is true) at a price level, 
					// and start hitting the ask, let's reverse

					if ((direction == 1) && startlookingforreversal && ((tickType == TickTypeEnum.AtAsk) || (tickType == TickTypeEnum.BetweenBidAsk)))
						direction = -1;

					else if ((direction == -1) && startlookingforreversal && ((tickType == TickTypeEnum.AtBid) || (tickType == TickTypeEnum.BetweenBidAsk)))
						direction = 1;	//buyers take control of ask
				}


				delta = direction * volume;

			}

			lastprice = price;
			lastdirection = direction;

			if ((filtermode == GomFilterModeType.OnlyLargerThan) && (volume <= filtersize))
				delta = 0;

			if ((filtermode == GomFilterModeType.OnlySmallerThan) && (volume >= filtersize))
				delta = 0;

			return delta;

		}
Ejemplo n.º 20
0
		public GomCD GomCD(GomCDCalculationModeType calcMode, GomCDChartType chart, string fileFormat, GomFilterModeType filterMode, int filterSize, bool reinitSession)
        {
            GomCD indy = GomCD(Input,calcMode,chart,reinitSession);
			indy.FileFormat=fileFormat;
            indy.FilterMode = filterMode;
            indy.FilterSize = filterSize;


            return indy;
        }