protected override void MyInitialize() { _indi = ZeroLagMacIndi(ADXMinimum, ADXPeriod, ATRPeriod, BreakevenTicks, InitialStoploss, MACDFast, MACDSlow, MACDSmooth, MMAtrEMAPeriod, MMAtrMultiplier, MMAtrPeriod, ProfitTicksBeforeBreakeven, RSILower, RSIPeriod, RSISmooth, RSIUpper); Add(_indi); TraceOrders = true; // InitialStoploss = 300; }
/// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public ZeroLagMacIndi ZeroLagMacIndi(Data.IDataSeries input, int aDXMinimum, int aDXPeriod, int aTRPeriod, int breakevenTicks, int initialStoploss, int mACDFast, int mACDSlow, int mACDSmooth, int mMAtrEMAPeriod, double mMAtrMultiplier, int mMAtrPeriod, int profitTicksBeforeBreakeven, int rSILower, int rSIPeriod, int rSISmooth, int rSIUpper) { if (cacheZeroLagMacIndi != null) for (int idx = 0; idx < cacheZeroLagMacIndi.Length; idx++) if (cacheZeroLagMacIndi[idx].ADXMinimum == aDXMinimum && cacheZeroLagMacIndi[idx].ADXPeriod == aDXPeriod && cacheZeroLagMacIndi[idx].ATRPeriod == aTRPeriod && cacheZeroLagMacIndi[idx].BreakevenTicks == breakevenTicks && cacheZeroLagMacIndi[idx].InitialStoploss == initialStoploss && cacheZeroLagMacIndi[idx].MACDFast == mACDFast && cacheZeroLagMacIndi[idx].MACDSlow == mACDSlow && cacheZeroLagMacIndi[idx].MACDSmooth == mACDSmooth && cacheZeroLagMacIndi[idx].MMAtrEMAPeriod == mMAtrEMAPeriod && Math.Abs(cacheZeroLagMacIndi[idx].MMAtrMultiplier - mMAtrMultiplier) <= double.Epsilon && cacheZeroLagMacIndi[idx].MMAtrPeriod == mMAtrPeriod && cacheZeroLagMacIndi[idx].ProfitTicksBeforeBreakeven == profitTicksBeforeBreakeven && cacheZeroLagMacIndi[idx].RSILower == rSILower && cacheZeroLagMacIndi[idx].RSIPeriod == rSIPeriod && cacheZeroLagMacIndi[idx].RSISmooth == rSISmooth && cacheZeroLagMacIndi[idx].RSIUpper == rSIUpper && cacheZeroLagMacIndi[idx].EqualsInput(input)) return cacheZeroLagMacIndi[idx]; lock (checkZeroLagMacIndi) { checkZeroLagMacIndi.ADXMinimum = aDXMinimum; aDXMinimum = checkZeroLagMacIndi.ADXMinimum; checkZeroLagMacIndi.ADXPeriod = aDXPeriod; aDXPeriod = checkZeroLagMacIndi.ADXPeriod; checkZeroLagMacIndi.ATRPeriod = aTRPeriod; aTRPeriod = checkZeroLagMacIndi.ATRPeriod; checkZeroLagMacIndi.BreakevenTicks = breakevenTicks; breakevenTicks = checkZeroLagMacIndi.BreakevenTicks; checkZeroLagMacIndi.InitialStoploss = initialStoploss; initialStoploss = checkZeroLagMacIndi.InitialStoploss; checkZeroLagMacIndi.MACDFast = mACDFast; mACDFast = checkZeroLagMacIndi.MACDFast; checkZeroLagMacIndi.MACDSlow = mACDSlow; mACDSlow = checkZeroLagMacIndi.MACDSlow; checkZeroLagMacIndi.MACDSmooth = mACDSmooth; mACDSmooth = checkZeroLagMacIndi.MACDSmooth; checkZeroLagMacIndi.MMAtrEMAPeriod = mMAtrEMAPeriod; mMAtrEMAPeriod = checkZeroLagMacIndi.MMAtrEMAPeriod; checkZeroLagMacIndi.MMAtrMultiplier = mMAtrMultiplier; mMAtrMultiplier = checkZeroLagMacIndi.MMAtrMultiplier; checkZeroLagMacIndi.MMAtrPeriod = mMAtrPeriod; mMAtrPeriod = checkZeroLagMacIndi.MMAtrPeriod; checkZeroLagMacIndi.ProfitTicksBeforeBreakeven = profitTicksBeforeBreakeven; profitTicksBeforeBreakeven = checkZeroLagMacIndi.ProfitTicksBeforeBreakeven; checkZeroLagMacIndi.RSILower = rSILower; rSILower = checkZeroLagMacIndi.RSILower; checkZeroLagMacIndi.RSIPeriod = rSIPeriod; rSIPeriod = checkZeroLagMacIndi.RSIPeriod; checkZeroLagMacIndi.RSISmooth = rSISmooth; rSISmooth = checkZeroLagMacIndi.RSISmooth; checkZeroLagMacIndi.RSIUpper = rSIUpper; rSIUpper = checkZeroLagMacIndi.RSIUpper; if (cacheZeroLagMacIndi != null) for (int idx = 0; idx < cacheZeroLagMacIndi.Length; idx++) if (cacheZeroLagMacIndi[idx].ADXMinimum == aDXMinimum && cacheZeroLagMacIndi[idx].ADXPeriod == aDXPeriod && cacheZeroLagMacIndi[idx].ATRPeriod == aTRPeriod && cacheZeroLagMacIndi[idx].BreakevenTicks == breakevenTicks && cacheZeroLagMacIndi[idx].InitialStoploss == initialStoploss && cacheZeroLagMacIndi[idx].MACDFast == mACDFast && cacheZeroLagMacIndi[idx].MACDSlow == mACDSlow && cacheZeroLagMacIndi[idx].MACDSmooth == mACDSmooth && cacheZeroLagMacIndi[idx].MMAtrEMAPeriod == mMAtrEMAPeriod && Math.Abs(cacheZeroLagMacIndi[idx].MMAtrMultiplier - mMAtrMultiplier) <= double.Epsilon && cacheZeroLagMacIndi[idx].MMAtrPeriod == mMAtrPeriod && cacheZeroLagMacIndi[idx].ProfitTicksBeforeBreakeven == profitTicksBeforeBreakeven && cacheZeroLagMacIndi[idx].RSILower == rSILower && cacheZeroLagMacIndi[idx].RSIPeriod == rSIPeriod && cacheZeroLagMacIndi[idx].RSISmooth == rSISmooth && cacheZeroLagMacIndi[idx].RSIUpper == rSIUpper && cacheZeroLagMacIndi[idx].EqualsInput(input)) return cacheZeroLagMacIndi[idx]; ZeroLagMacIndi indicator = new ZeroLagMacIndi(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.ADXMinimum = aDXMinimum; indicator.ADXPeriod = aDXPeriod; indicator.ATRPeriod = aTRPeriod; indicator.BreakevenTicks = breakevenTicks; indicator.InitialStoploss = initialStoploss; indicator.MACDFast = mACDFast; indicator.MACDSlow = mACDSlow; indicator.MACDSmooth = mACDSmooth; indicator.MMAtrEMAPeriod = mMAtrEMAPeriod; indicator.MMAtrMultiplier = mMAtrMultiplier; indicator.MMAtrPeriod = mMAtrPeriod; indicator.ProfitTicksBeforeBreakeven = profitTicksBeforeBreakeven; indicator.RSILower = rSILower; indicator.RSIPeriod = rSIPeriod; indicator.RSISmooth = rSISmooth; indicator.RSIUpper = rSIUpper; Indicators.Add(indicator); indicator.SetUp(); ZeroLagMacIndi[] tmp = new ZeroLagMacIndi[cacheZeroLagMacIndi == null ? 1 : cacheZeroLagMacIndi.Length + 1]; if (cacheZeroLagMacIndi != null) cacheZeroLagMacIndi.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheZeroLagMacIndi = tmp; return indicator; } }
/// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public ZeroLagMacIndi ZeroLagMacIndi(Data.IDataSeries input, int aDXMinimum, int aDXPeriod, int aTRPeriod, int breakevenTicks, int initialStoploss, int mACDFast, int mACDSlow, int mACDSmooth, int mMAtrEMAPeriod, double mMAtrMultiplier, int mMAtrPeriod, int profitTicksBeforeBreakeven, int rSILower, int rSIPeriod, int rSISmooth, int rSIUpper) { if (cacheZeroLagMacIndi != null) { for (int idx = 0; idx < cacheZeroLagMacIndi.Length; idx++) { if (cacheZeroLagMacIndi[idx].ADXMinimum == aDXMinimum && cacheZeroLagMacIndi[idx].ADXPeriod == aDXPeriod && cacheZeroLagMacIndi[idx].ATRPeriod == aTRPeriod && cacheZeroLagMacIndi[idx].BreakevenTicks == breakevenTicks && cacheZeroLagMacIndi[idx].InitialStoploss == initialStoploss && cacheZeroLagMacIndi[idx].MACDFast == mACDFast && cacheZeroLagMacIndi[idx].MACDSlow == mACDSlow && cacheZeroLagMacIndi[idx].MACDSmooth == mACDSmooth && cacheZeroLagMacIndi[idx].MMAtrEMAPeriod == mMAtrEMAPeriod && Math.Abs(cacheZeroLagMacIndi[idx].MMAtrMultiplier - mMAtrMultiplier) <= double.Epsilon && cacheZeroLagMacIndi[idx].MMAtrPeriod == mMAtrPeriod && cacheZeroLagMacIndi[idx].ProfitTicksBeforeBreakeven == profitTicksBeforeBreakeven && cacheZeroLagMacIndi[idx].RSILower == rSILower && cacheZeroLagMacIndi[idx].RSIPeriod == rSIPeriod && cacheZeroLagMacIndi[idx].RSISmooth == rSISmooth && cacheZeroLagMacIndi[idx].RSIUpper == rSIUpper && cacheZeroLagMacIndi[idx].EqualsInput(input)) { return(cacheZeroLagMacIndi[idx]); } } } lock (checkZeroLagMacIndi) { checkZeroLagMacIndi.ADXMinimum = aDXMinimum; aDXMinimum = checkZeroLagMacIndi.ADXMinimum; checkZeroLagMacIndi.ADXPeriod = aDXPeriod; aDXPeriod = checkZeroLagMacIndi.ADXPeriod; checkZeroLagMacIndi.ATRPeriod = aTRPeriod; aTRPeriod = checkZeroLagMacIndi.ATRPeriod; checkZeroLagMacIndi.BreakevenTicks = breakevenTicks; breakevenTicks = checkZeroLagMacIndi.BreakevenTicks; checkZeroLagMacIndi.InitialStoploss = initialStoploss; initialStoploss = checkZeroLagMacIndi.InitialStoploss; checkZeroLagMacIndi.MACDFast = mACDFast; mACDFast = checkZeroLagMacIndi.MACDFast; checkZeroLagMacIndi.MACDSlow = mACDSlow; mACDSlow = checkZeroLagMacIndi.MACDSlow; checkZeroLagMacIndi.MACDSmooth = mACDSmooth; mACDSmooth = checkZeroLagMacIndi.MACDSmooth; checkZeroLagMacIndi.MMAtrEMAPeriod = mMAtrEMAPeriod; mMAtrEMAPeriod = checkZeroLagMacIndi.MMAtrEMAPeriod; checkZeroLagMacIndi.MMAtrMultiplier = mMAtrMultiplier; mMAtrMultiplier = checkZeroLagMacIndi.MMAtrMultiplier; checkZeroLagMacIndi.MMAtrPeriod = mMAtrPeriod; mMAtrPeriod = checkZeroLagMacIndi.MMAtrPeriod; checkZeroLagMacIndi.ProfitTicksBeforeBreakeven = profitTicksBeforeBreakeven; profitTicksBeforeBreakeven = checkZeroLagMacIndi.ProfitTicksBeforeBreakeven; checkZeroLagMacIndi.RSILower = rSILower; rSILower = checkZeroLagMacIndi.RSILower; checkZeroLagMacIndi.RSIPeriod = rSIPeriod; rSIPeriod = checkZeroLagMacIndi.RSIPeriod; checkZeroLagMacIndi.RSISmooth = rSISmooth; rSISmooth = checkZeroLagMacIndi.RSISmooth; checkZeroLagMacIndi.RSIUpper = rSIUpper; rSIUpper = checkZeroLagMacIndi.RSIUpper; if (cacheZeroLagMacIndi != null) { for (int idx = 0; idx < cacheZeroLagMacIndi.Length; idx++) { if (cacheZeroLagMacIndi[idx].ADXMinimum == aDXMinimum && cacheZeroLagMacIndi[idx].ADXPeriod == aDXPeriod && cacheZeroLagMacIndi[idx].ATRPeriod == aTRPeriod && cacheZeroLagMacIndi[idx].BreakevenTicks == breakevenTicks && cacheZeroLagMacIndi[idx].InitialStoploss == initialStoploss && cacheZeroLagMacIndi[idx].MACDFast == mACDFast && cacheZeroLagMacIndi[idx].MACDSlow == mACDSlow && cacheZeroLagMacIndi[idx].MACDSmooth == mACDSmooth && cacheZeroLagMacIndi[idx].MMAtrEMAPeriod == mMAtrEMAPeriod && Math.Abs(cacheZeroLagMacIndi[idx].MMAtrMultiplier - mMAtrMultiplier) <= double.Epsilon && cacheZeroLagMacIndi[idx].MMAtrPeriod == mMAtrPeriod && cacheZeroLagMacIndi[idx].ProfitTicksBeforeBreakeven == profitTicksBeforeBreakeven && cacheZeroLagMacIndi[idx].RSILower == rSILower && cacheZeroLagMacIndi[idx].RSIPeriod == rSIPeriod && cacheZeroLagMacIndi[idx].RSISmooth == rSISmooth && cacheZeroLagMacIndi[idx].RSIUpper == rSIUpper && cacheZeroLagMacIndi[idx].EqualsInput(input)) { return(cacheZeroLagMacIndi[idx]); } } } ZeroLagMacIndi indicator = new ZeroLagMacIndi(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.ADXMinimum = aDXMinimum; indicator.ADXPeriod = aDXPeriod; indicator.ATRPeriod = aTRPeriod; indicator.BreakevenTicks = breakevenTicks; indicator.InitialStoploss = initialStoploss; indicator.MACDFast = mACDFast; indicator.MACDSlow = mACDSlow; indicator.MACDSmooth = mACDSmooth; indicator.MMAtrEMAPeriod = mMAtrEMAPeriod; indicator.MMAtrMultiplier = mMAtrMultiplier; indicator.MMAtrPeriod = mMAtrPeriod; indicator.ProfitTicksBeforeBreakeven = profitTicksBeforeBreakeven; indicator.RSILower = rSILower; indicator.RSIPeriod = rSIPeriod; indicator.RSISmooth = rSISmooth; indicator.RSIUpper = rSIUpper; Indicators.Add(indicator); indicator.SetUp(); ZeroLagMacIndi[] tmp = new ZeroLagMacIndi[cacheZeroLagMacIndi == null ? 1 : cacheZeroLagMacIndi.Length + 1]; if (cacheZeroLagMacIndi != null) { cacheZeroLagMacIndi.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheZeroLagMacIndi = tmp; return(indicator); } }