TradingView
HPotter
25 juil. 2014 04:14

FX Sniper: T3-CCI 

Euro Fx/U.S. DollarFXCM

Description

This simple indicator gives you a lot of useful information - when to enter, when to exit
and how to reduce risks by entering a trade on a double confirmed signal.
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
Commentaires
joe_vijay
Is there documentation we can read about this indicator?
Dare2
There is a whole lot of documentation on the net. Especially in the forex forums. Sniper is a forex trader. Do a search in forexfactory.com or forex-tsd.com.
Austininvegas
This thing is amazing
hrishi18
loved it... thanks
HPotter
@hrishi18, You are welcome.
SpLiFT
Hi HP. Great work on this indicator and all the other ones. I was wondering if you'd have the time and be able to code the following "stepless" MTF version of it too, as the one you've provided doesn't calculate in the same way? Thanks in advance and hope you can help!

=============================================
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 clrBlue
#property indicator_color2 clrRed
#property indicator_width1 3
#property indicator_width2 3
#property indicator_levelstyle STYLE_SOLID
#property indicator_levelcolor clrDeepSkyBlue
#property indicator_levelwidth 3

// Ergo Variables
extern ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT; // Time frame
extern int pq = 2;
extern int pr = 10;
extern int ps = 5;
extern int trigger = 3;
extern bool SoundAlert = false;
extern bool Interpolate = true; // Interpolate in mtf mode

//---- indicator buffers

string signal;
double mtm[];
double absmtm[];
double ErgoCCI[];
double MainCCI[];
double var1[];
double var2[];
double var2a[];
double var2b[];
double count[];
double alertTag;
string previous;

string indicatorFileName;
#define _mtfCall(_buff,_ind) iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,pq,pr,ps,trigger,SoundAlert,_buff,_ind)

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
for (int i=0; i<indicator_buffers; i++) SetIndexStyle(i,DRAW_LINE);
IndicatorBuffers(9);
SetIndexBuffer(0,ErgoCCI); SetIndexLabel(0,NULL);
SetIndexBuffer(1,MainCCI); SetIndexLabel(1,NULL);
SetIndexBuffer(2,mtm);
SetIndexBuffer(3,var1);
SetIndexBuffer(4,var2);
SetIndexBuffer(5,absmtm);
SetIndexBuffer(6,var2a);
SetIndexBuffer(7,var2b);
SetIndexBuffer(8,count);
SetLevelValue(0,0);

indicatorFileName = WindowExpertName();
TimeFrame = fmax(TimeFrame,_Period);

IndicatorShortName (timeFrameToString(TimeFrame)+" Fx_Sniper/s_Ergodic_CCI_Trigger");
return(0);
}
//+------------------------------------------------------------------+
//| Calculations |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=fmin(Bars-counted_bars,Bars-1); count[0] = limit;
if (TimeFrame!=_Period)
{
limit = (int)fmax(limit,fmin(Bars-1,_mtfCall(8,0)*TimeFrame/Period()));
for (i=limit;i>=0;i--)
{
int y = iBarShift(NULL,TimeFrame,Time);
ErgoCCI = _mtfCall(0,y);
MainCCI = _mtfCall(1,y);

//
//
//
//
//

if (!Interpolate || (i>0 && y==iBarShift(NULL,TimeFrame,Time[i-1]))) continue;
#define _interpolate(buff) buff[i+k] = buff+(buff[i+n]-buff)*k/n
int n,k; datetime time = iTime(NULL,TimeFrame,y);
for(n = 1; (i+n)<Bars && Time[i+n] >= time; n++) continue;
for(k = 1; k<n && (i+n)<Bars && (i+k)<Bars; k++)
{
_interpolate(ErgoCCI);
_interpolate(MainCCI);
}
}
return(0);
}

for(i=0; i <= Bars; i++) { mtm= Close- Close[i +1]; }
for(i=0; i <= Bars-1; i++) { absmtm = MathAbs(mtm); }
for(i=0; i <= Bars-1; i++) { var1= iMAOnArray(mtm,0,pq,0,MODE_EMA,i); }
for(i=0; i <= Bars-1; i++)
{
var2= iMAOnArray(var1,Bars,pr,0,MODE_EMA,i);
}
for(i=0; i <= Bars-1; i++)
{
var2a= iMAOnArray(absmtm,0,pq,0,MODE_EMA,i);
}
for(i=0; i <= Bars-1; i++)
{
var2b= iMAOnArray(var2a,0,pr,0,MODE_EMA,i);
}
for(i=0; i <= Bars-1; i++)
{
ErgoCCI = (500 * iMAOnArray(var2,0,ps,0,MODE_EMA,i))/(iMAOnArray(var2b,0,ps,0,MODE_EMA,i)); //var2a/var2b;

}
for(i=0; i<=Bars; i++)
{
MainCCI=iMAOnArray(ErgoCCI,0,trigger,0,MODE_SMA,i);
}

for(i=0; i<=Bars; i++)
{
if(previous=="") previous=signal;
if(MainCCI > ErgoCCI)
{
signal = "SHORT";
if(SoundAlert == true && previous != signal && alertTag!=Time[0]) {Alert("SHORT");alertTag = Time[0];}
previous=signal;
}
if (MainCCI < ErgoCCI)
{
signal = "LONG";
if(SoundAlert == true && previous != signal && alertTag!=Time[0]) {Alert("LONG");alertTag = Time[0];}
previous=signal;
}
if (MainCCI == ErgoCCI)
{
signal = "NEUTRAL";
if(SoundAlert == true && previous != signal && alertTag!=Time[0]) {Alert("Nuetral");alertTag = Time[0];}
previous=signal;
}
}
return(0);
}
//+------------------------------------------------------------------+

//+-------------------------------------------------------------------
//|
//+-------------------------------------------------------------------
//
//
//
//
//

string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};

string timeFrameToString(int tf)
{
for (int i=ArraySize(iTfTable)-1; i>=0; i--)
if (tf==iTfTable) return(sTfTable);
return("");
=============================================
oper573
Can this script be used in think or swim? I tried pasting the Squeeze Momentun indicator but had invalid statements so I called Hahn-Tech and they charge to port it over to think or swim.
SEyes83
Is there any way this can be applied to Think or swim?
LudmilaHanania
Thank you, would you please explain by is a double confirmed signal?
LudmilaHanania
sorry, mistype, meant to ask what is a double confirmed signal?
Plus