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); }
/// <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)); }
/// <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); } }
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); }
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); }
/// <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)); }
public Indicator.GomDeltaIndicator GomDeltaIndicator(bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize) { return(_indicator.GomDeltaIndicator(Input, backupMode, calcMode, filterMode, filterSize)); }
/// <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); } }
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; }
/// <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); }
/// <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); }
public Indicator.GomCD GomCD(GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession) { return _indicator.GomCD(Input, calcMode, chart, reinitSession); }
/// <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); }
/// <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; } }
/// <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; } }
/// <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)); }
public Indicator.GomDeltaIndicator GomDeltaIndicator(bool backupMode, GomCDCalculationModeType calcMode, GomFilterModeType filterMode, int filterSize) { return _indicator.GomDeltaIndicator(Input, backupMode, calcMode, filterMode, filterSize); }
public Indicator.GomCD GomCD(GomCDCalculationModeType calcMode, GomCDChartType chart, bool reinitSession) { return(_indicator.GomCD(Input, calcMode, chart, reinitSession)); }
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; }
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; }