schnucki2801 Posted September 8, 2010 Report Share Posted September 8, 2010 Hi, can everyone edit this indicator for MT4, it's only for Ninja Trader. Many thanks for your help. // // Copyright © 2006, NinjaTrader LLC <[email protected]>. // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release. // #region Using declarations using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Xml.Serialization; using NinjaTrader.Data; using NinjaTrader.Gui.Chart; #endregion #region NinjaScript generated code. Neither change nor remove. // This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { public partial class Indicator : IndicatorBase { private CCIDivV2[] cacheCCIDivV2 = null; private static CCIDivV2 checkCCIDivV2 = new CCIDivV2(); /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public CCIDivV2 CCIDivV2(int distance, int noOfBarsAfter, int noOfBarsBefore, int period, SoundCCI soundAlert, ProTypeCCIV2Dot term) { return CCIDivV2(Input, distance, noOfBarsAfter, noOfBarsBefore, period, soundAlert, term); } /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public CCIDivV2 CCIDivV2(Data.IDataSeries input, int distance, int noOfBarsAfter, int noOfBarsBefore, int period, SoundCCI soundAlert, ProTypeCCIV2Dot term) { if (cacheCCIDivV2 != null) for (int idx = 0; idx < cacheCCIDivV2.Length; idx++) if (cacheCCIDivV2[idx].Distance == distance && cacheCCIDivV2[idx].NoOfBarsAfter == noOfBarsAfter && cacheCCIDivV2[idx].NoOfBarsBefore == noOfBarsBefore && cacheCCIDivV2[idx].Period == period && cacheCCIDivV2[idx].SoundAlert == soundAlert && cacheCCIDivV2[idx].Term == term && cacheCCIDivV2[idx].EqualsInput(input)) return cacheCCIDivV2[idx]; lock (checkCCIDivV2) { checkCCIDivV2.Distance = distance; distance = checkCCIDivV2.Distance; checkCCIDivV2.NoOfBarsAfter = noOfBarsAfter; noOfBarsAfter = checkCCIDivV2.NoOfBarsAfter; checkCCIDivV2.NoOfBarsBefore = noOfBarsBefore; noOfBarsBefore = checkCCIDivV2.NoOfBarsBefore; checkCCIDivV2.Period = period; period = checkCCIDivV2.Period; checkCCIDivV2.SoundAlert = soundAlert; soundAlert = checkCCIDivV2.SoundAlert; checkCCIDivV2.Term = term; term = checkCCIDivV2.Term; if (cacheCCIDivV2 != null) for (int idx = 0; idx < cacheCCIDivV2.Length; idx++) if (cacheCCIDivV2[idx].Distance == distance && cacheCCIDivV2[idx].NoOfBarsAfter == noOfBarsAfter && cacheCCIDivV2[idx].NoOfBarsBefore == noOfBarsBefore && cacheCCIDivV2[idx].Period == period && cacheCCIDivV2[idx].SoundAlert == soundAlert && cacheCCIDivV2[idx].Term == term && cacheCCIDivV2[idx].EqualsInput(input)) return cacheCCIDivV2[idx]; CCIDivV2 indicator = new CCIDivV2(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Distance = distance; indicator.NoOfBarsAfter = noOfBarsAfter; indicator.NoOfBarsBefore = noOfBarsBefore; indicator.Period = period; indicator.SoundAlert = soundAlert; indicator.Term = term; Indicators.Add(indicator); indicator.SetUp(); CCIDivV2[] tmp = new CCIDivV2[cacheCCIDivV2 == null ? 1 : cacheCCIDivV2.Length + 1]; if (cacheCCIDivV2 != null) cacheCCIDivV2.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheCCIDivV2 = tmp; return indicator; } } } } // This namespace holds all market analyzer column definitions and is required. Do not change it. namespace NinjaTrader.MarketAnalyzer { public partial class Column : ColumnBase { /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> [Gui.Design.WizardCondition("Indicator")] public Indicator.CCIDivV2 CCIDivV2(int distance, int noOfBarsAfter, int noOfBarsBefore, int period, SoundCCI soundAlert, ProTypeCCIV2Dot term) { return _indicator.CCIDivV2(Input, distance, noOfBarsAfter, noOfBarsBefore, period, soundAlert, term); } /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public Indicator.CCIDivV2 CCIDivV2(Data.IDataSeries input, int distance, int noOfBarsAfter, int noOfBarsBefore, int period, SoundCCI soundAlert, ProTypeCCIV2Dot term) { return _indicator.CCIDivV2(input, distance, noOfBarsAfter, noOfBarsBefore, period, soundAlert, term); } } } // This namespace holds all strategies and is required. Do not change it. namespace NinjaTrader.Strategy { public partial class Strategy : StrategyBase { /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> [Gui.Design.WizardCondition("Indicator")] public Indicator.CCIDivV2 CCIDivV2(int distance, int noOfBarsAfter, int noOfBarsBefore, int period, SoundCCI soundAlert, ProTypeCCIV2Dot term) { return _indicator.CCIDivV2(Input, distance, noOfBarsAfter, noOfBarsBefore, period, soundAlert, term); } /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public Indicator.CCIDivV2 CCIDivV2(Data.IDataSeries input, int distance, int noOfBarsAfter, int noOfBarsBefore, int period, SoundCCI soundAlert, ProTypeCCIV2Dot term) { 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.CCIDivV2(input, distance, noOfBarsAfter, noOfBarsBefore, period, soundAlert, term); } } } #endregion Quote Link to comment Share on other sites More sharing options...
Saivenkat Posted September 12, 2010 Report Share Posted September 12, 2010 Hi Schnucki, I wish i could be helpful in this regard, but being a tech dumb.. i have no other go, just to google and find some links which are either CCI divergence indicators or Divergence indicators for MT4 h**p://forex.hikool.com/cci-divergence-v1-1-mt4-indicator h**p://www.forex-tsd.com/setup-questions/5281-divergence-indicator.html ( you could see a lot of links in the above) h**p://www.forex-tsd.com/indicators-metatrader-4/1318-reverse-divergence.html h**p://www.forex-tsd.com/indicators-metatrader-4/2301-divergence-detection-indicator.html h**p://www.forex-tsd.com/metatrader-4/1311-cci-divergence-indicator-chart-help.html Hope this helps you a little bit, and if so, Kudos please.:D With regards Saivenkat hermes 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.