Re: Fx Sniper's Ergodic CCI Trigger

231
Unfortunately i am zero in coding matters
but i think the ver you posted for mt4 is old enough belongs to 2007 or may be a bit more older
then it was touched by igor - later Mladen tweaked and enhanced it code wise,also added some extra but fine features in it,posting the one "Fx Sniper Ergodic CCI Trigger Alert Fast mtf arrows_v1 nmc"
almost arrows - alerts and interpolated mtf included too
though there are more extended and updated versions of it too at FS
Indicator is just a tool.

Use it only if it can benefit you. Leave it if you don't know how to use it optimally.


Re: Fx Sniper's Ergodic CCI Trigger

232
Neerav wrote: Thu Jan 10, 2019 7:12 am Thanks for the welcome and sorry, I did not know about the external links not allowed.
I need somebody to tell me what basically such indicator "is" in order to re-create it in my platform.

Below are the codes of Fx Sniper's Ergodic CCI Trigger for MT4 and Amibroker.

=====================================================================
code for MT4:

Code: Select all

//+------------------------------------------------------------------+
//|                                       Louw Coetzer aka FX Sniper |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                     
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, Fx Sniper."
#property  link      
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Blue
#property  indicator_color2  Red

// Ergo Variables
extern int pq =2;
extern int pr = 10;
extern int ps = 5;
extern int trigger =3;

//---- indicator buffers
string signal;
double mtm[];
double absmtm[];
double ErgoCCI[];
double MainCCI[];
double var1[];
double var2[];
double var2a[];
double var2b[];
//double valor1[];
//double valor2[];
//double extvar[];
//double cciSignal[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(8);
   
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,Blue);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,Red);
   SetIndexBuffer(0,ErgoCCI);
   SetIndexLabel(0,"Egodic CCI");
   SetIndexBuffer(1,MainCCI);
   SetIndexLabel(1,"Trigger Line");
   SetIndexBuffer(2,mtm);
   SetIndexBuffer(3,var1);
   SetIndexBuffer(4,var2);
   SetIndexBuffer(5,absmtm);
   SetIndexBuffer(6,var2a);
   SetIndexBuffer(7,var2b);
      
//---- name for DataWindow and indicator subwindow label
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Calculations                                    |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int i;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
 //---- main loop
   //---- done

   for(i=0; i <= Bars; i++) 
   {
   mtm[i]= Close[i]- Close[i +1];
   }
   for(i=0; i <= Bars-1; i++) 
   { 
    absmtm[i] =  MathAbs(mtm[i]);
   }
   for(i=0; i <= Bars-1; i++) 
   {   
    var1[i]= iMAOnArray(mtm,0,pq,0,MODE_EMA,i);
   }
   for(i=0; i <= Bars-1; i++) 
   {
   var2[i]= iMAOnArray(var1,Bars,pr,0,MODE_EMA,i);
   }
   for(i=0; i <= Bars-1; i++) 
   {
   var2a[i]= iMAOnArray(absmtm,0,pq,0,MODE_EMA,i);
   }
   for(i=0; i <= Bars-1; i++) 
   {
   var2b[i]= iMAOnArray(var2a,0,pr,0,MODE_EMA,i);
   }
    for(i=0; i <= Bars-1; i++) 
   {   
   ErgoCCI[i] = (500 * iMAOnArray(var2,0,ps,0,MODE_EMA,i))/(iMAOnArray(var2b,0,ps,0,MODE_EMA,i)); //var2a[i]/var2b[i];
   
   }
   for(i=0; i<=Bars; i++)
   {
     MainCCI[i]=iMAOnArray(ErgoCCI,0,trigger,0,MODE_EMA,i);
   }
   
   for(i=0; i<=Bars; i++)
   {
      if(MainCCI[i] > ErgoCCI[i])
      {signal = "SHORT";}
      if (MainCCI[i] < ErgoCCI[i])
      {signal = "LONG";}
      if (MainCCI[i] == ErgoCCI[i])
      {signal = "NEUTRAL";}
 IndicatorShortName("FX Sniper's Ergodic CCI & Trigger: "+signal);
 return(0); }
  }

=====================================================================

Code for AMIBROKER:

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// ErgoCCI
    /// </summary>
    [Description("ErgoCCI")]
    public class ErgoCCI : Indicator
    {
        #region Variables
			private int pq =2;
			private int pr = 10;
			private int ps = 5;
			private int trigger =3;
                        private DataSeries mtm;
			private DataSeries var1;
			private DataSeries var2;
			private DataSeries mtmAbs;
			private DataSeries var2a;
			private DataSeries var2b;
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            Add(new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "MainCCI"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "ErgCCI"));
            CalculateOnBarClose	= true;
            Overlay				= false;
            PriceTypeSupported	= false;

			mtm = new DataSeries(this);
			var1 = new DataSeries(this);
			var2 = new DataSeries(this);
			mtmAbs = new DataSeries(this);
			var2a = new DataSeries(this);
			var2b = new DataSeries(this);
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            if(CurrentBar<1) return;
			
			mtm.Set (Close[0]-Close[1]);
			var1.Set(EMA(mtm, pq)[0]);
			var2.Set(EMA(var1, pr)[0]);
			
			mtmAbs.Set(Math.Abs(Close[0]-Close[1]));
			var2a.Set(EMA(mtmAbs,pq)[0]);
			var2b.Set(EMA(var2a,pr)[0]);
			
            ErgCCI.Set(500* (EMA(var2,ps)[0])/(EMA(var2b,ps)[0]));
			
			MainCCI.Set(EMA(ErgCCI,trigger)[0]);
        }

        #region Properties
        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries MainCCI
        {
            get { return Values[0]; }
        }

        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries ErgCCI
        {
            get { return Values[1]; }
        }

        [Description("EMA period")]
		[XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        [Category("Parameters")]
        public int PQ
        {
            get { return pq; }
            set { pq = Math.Max(1, value); }
        }
		[Description("EMA period")]
		[XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        [Category("Parameters")]
        public int PR
        {
            get { return pr; }
            set { pr = Math.Max(1, value); }
        }
		[Description("EMA period")]
		[XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        [Category("Parameters")]
        public int PS
        {
            get { return ps; }
            set { ps = Math.Max(1, value); }
        }
		[Description("EMA period")]
		[XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        [Category("Parameters")]
        public int Trigger
        {
            get { return trigger; }
            set { trigger = Math.Max(1, value); }
        }
        #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 ErgoCCI[] cacheErgoCCI = null;

        private static ErgoCCI checkErgoCCI = new ErgoCCI();

        /// <summary>
        /// ErgoCCI
        /// </summary>
        /// <returns></returns>
        public ErgoCCI ErgoCCI(int pQ, int pR, int pS, int trigger)
        {
            return ErgoCCI(Input, pQ, pR, pS, trigger);
        }

        /// <summary>
        /// ErgoCCI
        /// </summary>
        /// <returns></returns>
        public ErgoCCI ErgoCCI(Data.IDataSeries input, int pQ, int pR, int pS, int trigger)
        {
            checkErgoCCI.PQ = pQ;
            pQ = checkErgoCCI.PQ;
            checkErgoCCI.PR = pR;
            pR = checkErgoCCI.PR;
            checkErgoCCI.PS = pS;
            pS = checkErgoCCI.PS;
            checkErgoCCI.Trigger = trigger;
            trigger = checkErgoCCI.Trigger;

            if (cacheErgoCCI != null)
                for (int idx = 0; idx < cacheErgoCCI.Length; idx++)
                    if (cacheErgoCCI[idx].PQ == pQ && cacheErgoCCI[idx].PR == pR && cacheErgoCCI[idx].PS == pS && cacheErgoCCI[idx].Trigger == trigger && cacheErgoCCI[idx].EqualsInput(input))
                        return cacheErgoCCI[idx];

            ErgoCCI indicator = new ErgoCCI();
            indicator.BarsRequired = BarsRequired;
            indicator.CalculateOnBarClose = CalculateOnBarClose;
            indicator.Input = input;
            indicator.PQ = pQ;
            indicator.PR = pR;
            indicator.PS = pS;
            indicator.Trigger = trigger;
            indicator.SetUp();

            ErgoCCI[] tmp = new ErgoCCI[cacheErgoCCI == null ? 1 : cacheErgoCCI.Length + 1];
            if (cacheErgoCCI != null)
                cacheErgoCCI.CopyTo(tmp, 0);
            tmp[tmp.Length - 1] = indicator;
            cacheErgoCCI = tmp;
            Indicators.Add(indicator);

            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>
        /// ErgoCCI
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.ErgoCCI ErgoCCI(int pQ, int pR, int pS, int trigger)
        {
            return _indicator.ErgoCCI(Input, pQ, pR, pS, trigger);
        }

        /// <summary>
        /// ErgoCCI
        /// </summary>
        /// <returns></returns>
        public Indicator.ErgoCCI ErgoCCI(Data.IDataSeries input, int pQ, int pR, int pS, int trigger)
        {
            return _indicator.ErgoCCI(input, pQ, pR, pS, trigger);
        }

    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public partial class Strategy : StrategyBase
    {
        /// <summary>
        /// ErgoCCI
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.ErgoCCI ErgoCCI(int pQ, int pR, int pS, int trigger)
        {
            return _indicator.ErgoCCI(Input, pQ, pR, pS, trigger);
        }

        /// <summary>
        /// ErgoCCI
        /// </summary>
        /// <returns></returns>
        public Indicator.ErgoCCI ErgoCCI(Data.IDataSeries input, int pQ, int pR, int pS, int trigger)
        {
            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.ErgoCCI(input, pQ, pR, pS, trigger);
        }

    }
}
#endregion
Have this simplified version.
These users thanked the author mrtools for the post:
reachme

Re: CCI indicators for MT4

235
Tether23 wrote: Thu Jan 31, 2019 6:44 am



Sorry for bringing back such an old thread could you tell me what indicator is the one with the dots on chart?
Nothing is old and or expired just should be usefull
i think that is not single one indicator on chart but more than one
dont remember at the moment dots coming from which one,may be if able to find later,will be tell or post here for you
Indicator is just a tool.

Use it only if it can benefit you. Leave it if you don't know how to use it optimally.


Re: CCI indicators for MT4

239
Here is Mrtools's Multi-Symbol CCI from a few years ago which also came with Multi-timeframe mode and interpolation. This indicator comes with an array of options including up to 8 pairs display, adjustable widths and more.
These users thanked the author Jimmy for the post (total 4):
reachme, moey_dw, FBI, fxchampion
Are you looking for a Forex broker? FBS cuts spreads by up to 58%. Click here to begin your trading journey, today.
No commissions are earned by Forex-station.


Guide to the "All Averages" Filters (ADXvma, Laguerre etc.) 🆕
Use Fibonacci numbers for indicator settings + How to draw Fibonacci Extensions
An easy trick for drawing Support & Resistance


Who is online

Users browsing this forum: Antonov, ffsss, Majestic-12 [Bot], sdsdzk, Tradehunter, vvFish and 114 guests