Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
CCI_Cross_New-2 only 25-40 +Alert
//+------------------------------------------------------------------+
//| CCI_Cross.mq4 |
//| Copyright © 2006, Eli Hayun |
//| http://www.elihayun.com |
//| Built for ValeoFX |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Eli Hayun"
#property link "http://www.elihayun.com"
#include <Pop.mqh>
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 EMPTY//Red// 5-CCi
#property indicator_width1 0
#property indicator_color2 EMPTY//Red//5-CCi
#property indicator_width2 0
#property indicator_color3 Yellow//15-CCi
#property indicator_width3 3
#property indicator_color4 Yellow //15-CCi
#property indicator_width4 3
#property indicator_color5 GreenYellow//40-CCi
#property indicator_width5 4
#property indicator_color6 GreenYellow // 40-CCi
#property indicator_width6 4
//---- input parameters --------------------------------------------
extern int FastCCI=5;
extern int SlowCCI=25;//15
extern int VerySlowCCI=40;//28
extern int Move_Arrow = 5 ;//5 werk nie; kort nog iets onder sê Gerhard.
extern int SlowCCI.Alert.Level=81;
extern int VerySlowCCI.Alert.Level=0;
extern bool Use.CCI.Slow.Alert = True;
extern bool Use.CCI.VerySlow.Alert = True;
datetime SlowAlertTag;
string SlowSignal;
string SlowLastSignal;
int iSlowAlertCount=0;
datetime VSlowAlertTag;
string VSlowSignal;
string VSlowLastSignal;
int iVSlowAlertCount=0;
//---- buffers -----------------------------------------------------
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_NONE);
SetIndexArrow(0,241);//217
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_NONE);
SetIndexArrow(1,242);//218
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID, 3);
SetIndexArrow(2,221);//221
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(3,222);//222
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexEmptyValue(3,0.0);
SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID,5);
SetIndexArrow(4,241);//241
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexEmptyValue(4,0.0);
SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID,5);
SetIndexArrow(5,242);//242
SetIndexBuffer(5,ExtMapBuffer6);
SetIndexEmptyValue(5,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int shift;
for(shift=Bars-1;shift>=0;shift--)
{
ExtMapBuffer1[shift] = 0; ExtMapBuffer2[shift] = 0; ExtMapBuffer3[shift] = 0;
ExtMapBuffer4[shift] = 0; ExtMapBuffer5[shift] = 0; ExtMapBuffer6[shift] = 0;
double fCCI_0 = iCCI(NULL, 0, FastCCI, PRICE_TYPICAL, shift);
double fCCI_1 = iCCI(NULL, 0, FastCCI, PRICE_TYPICAL, shift+1);
double fCCI_2 = iCCI(NULL, 0, FastCCI, PRICE_TYPICAL, shift+2);
if (fCCI_0 > 35 && fCCI_1< 35 )//*********************************
ExtMapBuffer1[shift] = Low[shift] - 3 * Point;
if (fCCI_0 < -35 && fCCI_1> -35 )//*******************************
ExtMapBuffer2[shift] = High[shift] + 3 * Point;
//---------------------
double sCCI_0 = iCCI(NULL, 0, SlowCCI, PRICE_TYPICAL, shift);
double sCCI_1 = iCCI(NULL, 0, SlowCCI, PRICE_TYPICAL, shift+1);
double sCCI_2 = iCCI(NULL, 0, SlowCCI, PRICE_TYPICAL, shift+2);
if (sCCI_0 > SlowCCI.Alert.Level && sCCI_1< SlowCCI.Alert.Level && sCCI_2 < SlowCCI.Alert.Level) //71//62 *****************************************
{
ExtMapBuffer3[shift] = Low[shift] - 4 * Point;
SlowSignal="Long";
if ((Use.CCI.Slow.Alert) && (shift==0))
{ if ((SlowLastSignal != SlowSignal) && (SlowAlertTag!=Time[0]) && (iSlowAlertCount==0))
{
Alert ("Slow CCI Crossing Above +",SlowCCI.Alert.Level,"\n Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
pop ((Symbol()+" "+Period()+"min"+" Slow CCI Crossing above +"+SlowCCI.Alert.Level), "C:\\");
SlowAlertTag = Time[0];
SlowLastSignal=SlowSignal;
iSlowAlertCount++;
}
}
}
if (sCCI_0 < (VerySlowCCI.Alert.Level*(-1)) && sCCI_1> (VerySlowCCI.Alert.Level*(-1)) && sCCI_2 > (VerySlowCCI.Alert.Level*(-1)))//71//62 **************************************
{
ExtMapBuffer4[shift] = High[shift] + 4 * Point;
SlowSignal="Short";
if ((Use.CCI.Slow.Alert) && (shift==0))
{ if ((SlowLastSignal != SlowSignal) && (SlowAlertTag!=Time[0]) && (iSlowAlertCount==0))
{
Alert ("Slow CCI Crossing below -",SlowCCI.Alert.Level,"\n Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
pop ((Symbol()+" "+Period()+"min"+" Slow CCI Crossing below -"+SlowCCI.Alert.Level), "C:\\");
SlowAlertTag = Time[0];
SlowLastSignal=SlowSignal;
iSlowAlertCount++;
}
}
}
//----------------------
double vsCCI_0 = iCCI(NULL, 0, VerySlowCCI, PRICE_TYPICAL, shift);
double vsCCI_1 = iCCI(NULL, 0, VerySlowCCI, PRICE_TYPICAL, shift+1);
double vsCCI_2 = iCCI(NULL, 0, VerySlowCCI, PRICE_TYPICAL, shift+2);
if (vsCCI_0 > 0 && vsCCI_1< 0 && vsCCI_2 < 0)//51//35*****************
{
ExtMapBuffer5[shift] = Low[shift] - 5 * Point;
VSlowSignal="Long";
if ((Use.CCI.VerySlow.Alert) && (shift==0))
{ if ((VSlowLastSignal != VSlowSignal) && (VSlowAlertTag!=Time[0]) && (iVSlowAlertCount==0))
{
Alert ("Very Slow CCI Crossing above +"+VerySlowCCI.Alert.Level,"\n Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
pop ((Symbol()+" "+Period()+"min"+" Very Slow CCI Crossing above +"+VerySlowCCI.Alert.Level), "C:\\");
VSlowAlertTag = Time[0];
VSlowLastSignal=VSlowSignal;
iVSlowAlertCount++;
}
}
}
if (vsCCI_0 < -0 && vsCCI_1> -0 && vsCCI_2 > -0)//51******************
{
ExtMapBuffer6[shift] = High[shift] + 5 * Point;
VSlowSignal="Short";
if ((Use.CCI.VerySlow.Alert) && (shift==0))
{ if ((VSlowLastSignal != VSlowSignal) && (VSlowAlertTag!=Time[0]) && (iVSlowAlertCount==0))
{
Alert ("Very Slow CCI Crossing below -",VerySlowCCI.Alert.Level,"\n Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
pop ((Symbol()+" "+Period()+"min"+" Very Slow CCI Crossing below -"+VerySlowCCI.Alert.Level), "C:\\");
VSlowAlertTag = Time[0];
VSlowLastSignal=VSlowSignal;
iVSlowAlertCount++;
}
}
}
}
string sComment = "";
if (ExtMapBuffer1[0] != 0)
sComment = sComment + " 1st UP";
if (ExtMapBuffer2[0] != 0)
sComment = sComment + " 1st Down";
if (ExtMapBuffer3[0] != 0)
sComment = sComment + " 2nd UP";
if (ExtMapBuffer4[0] != 0)
sComment = sComment + " 2nd Down";
if (ExtMapBuffer5[0] != 0)
sComment = sComment + " 3rd UP";
if (ExtMapBuffer6[0] != 0)
sComment = sComment + " 3rd Down";
if ((sComment != "") && (!IsTesting()))
{
if (NewBar())
{
PlaySound("wait.wav");//"expert.wav");
Print(Symbol(), " ", sComment);
}
Comment(TimeToStr(CurTime()), " ", sComment);
}
if ((sComment == "") && (!IsTesting()))
{
Comment("");
}
return(0);
}
//+------------------------------------------------------------------+
bool NewBar()
{
static datetime dt = 0;
//if (dt == 0) dt = Time[0];
if (dt != Time[0])
{
dt = Time[0];
return(true);
}
return(false);
}
//===================================================================
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---