▼Recently uploaded Indicators
88_filter.mq4
7 Indexes 13 MA TT Rus.mq4
6vMACDonchart.mq4
62_VolumeTicksSepa.mq4
5NITRO.ex4
5MinutesScalping-i5.ex4
5 sing zz alert.mq4
4SSA + ma.mq4
4price_channel_central alert F.mq4
4BAMSBUNG_FLAME.mq4
4_Scalp_TREND-SENTRY_m_slow.mq4
4 TREND candles.mq4
4 time frame d2.mq4
3rdCandle.mq4
3_Level_ZZ_Semafor.ex4
2×2.mq4
2iaPiCi.mq4
2dNonLagTMA_VS.mq4
2 candles BW-2.mq4
1YRH mark.ex4
1TMAcentered MACD v2.mq4
1Prsi CCi.mq4
1_2_3 Semafor.mq4
19_ColorStochastic (600+).mq4
10.7 TDMTL_ALERT V1.3.mq4
10.7 LINE OF ZERO.mq4
10.4 SSG 20only.mq4
1 Candle OL & OH_delta_fix.mq4
0TMA+CG mladen.mq4
0FractalAMA_MBK.mq4
00-ShinNeAshi_v101.ex4
00-ShinNeAshi.mq4
00-HighLowBand_v100.mq4
0 MTH Double Donchian Channel v01.ex4
8 candles tarwada 02.mq4
7509056.mq4
5min_ind1.ex4
4hrTrader.ex4
4EREPA_Hi_SYS2_5.mq4
4_Scalp_TREND-SENTRY_m.mq4
1ssrc.mq4
1roughsmi.mq4
1ff_013.mq4
16-07-Waddah_Attar_Explosion.mq4
16-01-TTM scalper.mq4
10.2 TMA slope v.1.4B 4.30Alert.mq4
0-0-TANGO.mq4
3Line_Break.mq4
3c_jrsx_h.mq4
3BullsEye_Forecaster_V1.0_2.ex4
3barpullback.mq4
1rsxBO2.ex4
100pipstodayscalper.mq4
1-Retracement Finder1.mq4
4_level_zz_semafor_2.mq4
10.2 TMA slope v.1.4B 4.30.ex4
3c_JRSX_h v1.ex4
61 HiLo 1.3.mq4
3Momentum onChartSignals Indicator v1.0.mq4
3linebreak.mq4
0Momentum onChartSignals Indicator v1.0__1.mq4

3_Level_ZZ_Semafor_mtf p alerts nmc.mq4

3_level_zz_semafor_mtf-p-alerts-nmc-mq4

3_Level_ZZ_Semafor_mtf p alerts nmc.mq4 source code
free download page

//+——————————————————————+
//| 3_Level_ZZ_Semafor.mq4 |
//+——————————————————————+

#property copyright “asystem2000”
#property link “asystem2000@yandex.ru”

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Chocolate
#property indicator_color2 Chocolate
#property indicator_color3 MediumVioletRed
#property indicator_color4 MediumVioletRed
#property indicator_color5 Yellow
#property indicator_color6 Yellow

//
//
//
//
//

extern string TimeFrame = “Current time frame”;
extern double Period1 = 5; //5
extern double Period2 = 13; //13
extern double Period3 = 34;
extern string Dev_Step_1 = “1,3”;
extern string Dev_Step_2 = “8,5”;
extern string Dev_Step_3 = “13,8”;
extern int Symbol_1_Kod = 140;
extern int Symbol_2_Kod = 141;
extern int Symbol_3_Kod = 142;
extern bool alertsOn = false;
extern bool alertsOnCurrent = false;
extern bool alertsMessage = true;
extern bool alertsSound = false;
extern bool alertsNotify = false;
extern bool alertsEmail = false;
extern bool DotOnFirstBar = true;

//—- buffers
double FP_BuferUp[];
double FP_BuferDn[];
double NP_BuferUp[];
double NP_BuferDn[];
double HP_BuferUp[];
double HP_BuferDn[];

int F_Period;
int N_Period;
int H_Period;
int Dev1;
int Stp1;
int Dev2;
int Stp2;
int Dev3;
int Stp3;

string indicatorFileName;
bool returnBars;
int timeFrame;

//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{

if (Period1>0) F_Period=MathCeil(Period1*Period()); else F_Period=0;
if (Period2>0) N_Period=MathCeil(Period2*Period()); else N_Period=0;
if (Period3>0) H_Period=MathCeil(Period3*Period()); else H_Period=0;

//—- Œ·‡·‡Ú˚‚‡ÂÏ 1 ·ÛÙÂ
if (Period1>0)
{
SetIndexStyle(0,DRAW_ARROW,0,2);
SetIndexArrow(0,Symbol_1_Kod);
SetIndexBuffer(0,FP_BuferUp);
SetIndexEmptyValue(0,0.0);

SetIndexStyle(1,DRAW_ARROW,0,2);
SetIndexArrow(1,Symbol_1_Kod);
SetIndexBuffer(1,FP_BuferDn);
SetIndexEmptyValue(1,0.0);
}

//—- Œ·‡·‡Ú˚‚‡ÂÏ 2 ·ÛÙÂ
if (Period2>0)
{
SetIndexStyle(2,DRAW_ARROW,0,3);
SetIndexArrow(2,Symbol_2_Kod);
SetIndexBuffer(2,NP_BuferUp);
SetIndexEmptyValue(2,0.0);

SetIndexStyle(3,DRAW_ARROW,0,3);
SetIndexArrow(3,Symbol_2_Kod);
SetIndexBuffer(3,NP_BuferDn);
SetIndexEmptyValue(3,0.0);
}
//—- Œ·‡·‡Ú˚‚‡ÂÏ 3 ·ÛÙÂ
if (Period3>0)
{
SetIndexStyle(4,DRAW_ARROW,0,4);
SetIndexArrow(4,Symbol_3_Kod);
SetIndexBuffer(4,HP_BuferUp);
SetIndexEmptyValue(4,0.0);

SetIndexStyle(5,DRAW_ARROW,0,4);
SetIndexArrow(5,Symbol_3_Kod);
SetIndexBuffer(5,HP_BuferDn);
SetIndexEmptyValue(5,0.0);
}
// Œ·‡·‡Ú˚‚‡ÂÏ Á̇˜ÂÌˡ ‰Â‚ˇˆËÈ Ë ¯‡„Ó‚
int CDev=0;
int CSt=0;
int Mass[];
int C=0;
if (IntFromStr(Dev_Step_1,C, Mass)==1)
{
Stp1=Mass[1];
Dev1=Mass[0];
}

if (IntFromStr(Dev_Step_2,C, Mass)==1)
{
Stp2=Mass[1];
Dev2=Mass[0];
}

if (IntFromStr(Dev_Step_3,C, Mass)==1)
{
Stp3=Mass[1];
Dev3=Mass[0];
}
indicatorFileName = WindowExpertName();
returnBars = TimeFrame == “returnBars”; if (returnBars) return(0);
timeFrame = stringToTimeFrame(TimeFrame);
return(0);
}
//+——————————————————————+
//| Custor indicator deinitialization function |
//+——————————————————————+
int deinit()
{
return(0);
}

//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{

int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars–;
int limit=MathMin(Bars-counted_bars,Bars-1);
if (returnBars) { FP_BuferUp[0] = limit+1; return(0); }

if (timeFrame!=Period())
{
int shift = -1; if (DotOnFirstBar) shift=1;
limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,”returnBars”,0,0)*timeFrame/Period()));
for (int i=limit; i>=0; i–)
{
int y = iBarShift(NULL,timeFrame,Time[i]);
int x = iBarShift(NULL,timeFrame,Time[i+shift]);
if (x!=y)
{
FP_BuferUp[i] = iCustom(NULL,timeFrame,indicatorFileName,”calculateValue”,Period1,Period2,Period3,Dev_Step_1,Dev_Step_2,Dev_Step_3,Symbol_1_Kod,Symbol_2_Kod,Symbol_3_Kod,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsNotify,alertsEmail,0,y);
FP_BuferDn[i] = iCustom(NULL,timeFrame,indicatorFileName,”calculateValue”,Period1,Period2,Period3,Dev_Step_1,Dev_Step_2,Dev_Step_3,Symbol_1_Kod,Symbol_2_Kod,Symbol_3_Kod,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsNotify,alertsEmail,1,y);
NP_BuferUp[i] = iCustom(NULL,timeFrame,indicatorFileName,”calculateValue”,Period1,Period2,Period3,Dev_Step_1,Dev_Step_2,Dev_Step_3,Symbol_1_Kod,Symbol_2_Kod,Symbol_3_Kod,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsNotify,alertsEmail,2,y);
NP_BuferDn[i] = iCustom(NULL,timeFrame,indicatorFileName,”calculateValue”,Period1,Period2,Period3,Dev_Step_1,Dev_Step_2,Dev_Step_3,Symbol_1_Kod,Symbol_2_Kod,Symbol_3_Kod,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsNotify,alertsEmail,3,y);
HP_BuferUp[i] = iCustom(NULL,timeFrame,indicatorFileName,”calculateValue”,Period1,Period2,Period3,Dev_Step_1,Dev_Step_2,Dev_Step_3,Symbol_1_Kod,Symbol_2_Kod,Symbol_3_Kod,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsNotify,alertsEmail,4,y);
HP_BuferDn[i] = iCustom(NULL,timeFrame,indicatorFileName,”calculateValue”,Period1,Period2,Period3,Dev_Step_1,Dev_Step_2,Dev_Step_3,Symbol_1_Kod,Symbol_2_Kod,Symbol_3_Kod,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsNotify,alertsEmail,5,y);
}
}
return(0);
}

if (Period1>0) CountZZ(FP_BuferUp,FP_BuferDn,Period1,Dev1,Stp1);
if (Period2>0) CountZZ(NP_BuferUp,NP_BuferDn,Period2,Dev2,Stp2);
if (Period3>0) CountZZ(HP_BuferUp,HP_BuferDn,Period3,Dev3,Stp3);

//
//
//
//
//

if (alertsOn)
{
if (alertsOnCurrent)
int whichBar = 0;
else whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar));

//
//
//
//
//

static string type1 = “”;
static datetime time1 = 0;
if (FP_BuferUp[whichBar] != 0 && FP_BuferUp[whichBar+1] == 0) doAlert(type1,time1,” #1 UP”);
if (FP_BuferDn[whichBar] != 0 && FP_BuferDn[whichBar+1] == 0) doAlert(type1,time1,” #1 DOWN”);
static string type2 = “”;
static datetime time2 = 0;
if (NP_BuferUp[whichBar] != 0 && NP_BuferUp[whichBar+1] == 0) doAlert(type2,time2,” #2 UP”);
if (NP_BuferDn[whichBar] != 0 && NP_BuferDn[whichBar+1] == 0) doAlert(type2,time2,” #2 DOWN”);
static string type3 = “”;
static datetime time3 = 0;
if (HP_BuferUp[whichBar] != 0 && HP_BuferUp[whichBar+1] == 0) doAlert(type3,time3,” #3 UP”);
if (HP_BuferDn[whichBar] != 0 && HP_BuferDn[whichBar+1] == 0) doAlert(type3,time3,” #3 DOWN”);
}
return(0);
}

//
//
//+——————————————————————+
//| ‘ÛÌ͈ ÙÓÏËÓ‚‡Ìˡ «Ë„«‡„‡ |
//+——————————————————————+

void CountZZ( double& ExtMapBuffer[], double& ExtMapBuffer2[], int ExtDepth, int ExtDeviation, int ExtBackstep )
{
int shift, back,lasthighpos,lastlowpos;
double val,res;
double curlow,curhigh,lasthigh,lastlow;

for(shift=Bars-ExtDepth; shift>=0; shift–)
{
val=Low[iLowest(NULL,0,MODE_LOW,ExtDepth,shift)];
if(val==lastlow) val=0.0;
else
{
lastlow=val;
if((Low[shift]-val)>(ExtDeviation*Point*MathPow(10,Digits%2))) val=0.0;
else
{
for(back=1; back<=ExtBackstep; back++) { res=ExtMapBuffer[shift+back]; if((res!=0)&&(res>val)) ExtMapBuffer[shift+back]=0.0;
}
}
}

ExtMapBuffer[shift]=val;
//— high
val=High[iHighest(NULL,0,MODE_HIGH,ExtDepth,shift)];
if(val==lasthigh) val=0.0;
else
{
lasthigh=val;
if((val-High[shift])>(ExtDeviation*Point*MathPow(10,Digits%2))) val=0.0;
else
{
for(back=1; back<=ExtBackstep; back++) { res=ExtMapBuffer2[shift+back]; if((res!=0)&&(res=0; shift–)
{
curlow=ExtMapBuffer[shift];
curhigh=ExtMapBuffer2[shift];
if((curlow==0)&&(curhigh==0)) continue;
//—
if(curhigh!=0)
{
if(lasthigh>0)
{
if(lasthigh0)
{
if(lastlow>curlow) ExtMapBuffer[lastlowpos]=0;
else ExtMapBuffer[shift]=0;
}
//—
if((curlow=0; shift–)
{
if(shift>=Bars-ExtDepth) ExtMapBuffer[shift]=0.0;
else
{
res=ExtMapBuffer2[shift];
if(res!=0.0) ExtMapBuffer2[shift]=res;
}
}
}

//+——————————————————————+
int Str2Massive(string VStr, int& M_Count, int& VMass[])
{
int val=StrToInteger( VStr);
if (val>0)
{
M_Count++;
int mc=ArrayResize(VMass,M_Count);
if (mc==0)return(-1);
VMass[M_Count-1]=val;
return(1);
}
else return(0);
}

//+——————————————————————+
int IntFromStr(string ValStr,int& M_Count, int& VMass[])
{

if (StringLen(ValStr)==0) return(-1);
string SS=ValStr;
int NP=0;
string CS;
M_Count=0;
ArrayResize(VMass,M_Count);
while (StringLen(SS)>0)
{
NP=StringFind(SS,”,”);
if (NP>0)
{
CS=StringSubstr(SS,0,NP);
SS=StringSubstr(SS,NP+1,StringLen(SS));
}
else
{
if (StringLen(SS)>0)
{
CS=SS;
SS=””;
}
}
if (Str2Massive(CS,M_Count,VMass)==0)
{
return(-2);
}
}
return(1);
}

//+——————————————————————+
//
//
//
//
//

void doAlert(string& previousAlert, datetime& previousTime, string doWhat)
{
string message;

if (previousAlert != doWhat || previousTime != Time[0]) {
previousAlert = doWhat;
previousTime = Time[0];

//
//
//
//
//

message = StringConcatenate(Symbol(),” “,timeFrameToString(timeFrame),” at “,TimeToStr(TimeLocal(),TIME_SECONDS),” 3 Level Semafor “,doWhat);
if (alertsMessage) Alert(message);
if (alertsNotify) SendNotification(message);
if (alertsEmail) SendMail(StringConcatenate(Symbol(),” 3 Level Semafor “),message);
if (alertsSound) PlaySound(“alert2.wav”);
}
}

//——————————————————————-
//
//——————————————————————-
//
//
//
//
//

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

//
//
//
//
//

int stringToTimeFrame(string tfs)
{
tfs = stringUpperCase(tfs);
for (int i=ArraySize(iTfTable)-1; i>=0; i–)
if (tfs==sTfTable[i] || tfs==””+iTfTable[i]) return(MathMax(iTfTable[i],Period()));
return(Period());
}
string timeFrameToString(int tf)
{
for (int i=ArraySize(iTfTable)-1; i>=0; i–)
if (tf==iTfTable[i]) return(sTfTable[i]);
return(“”);
}

//
//
//
//
//

string stringUpperCase(string str)
{
string s = str;

for (int length=StringLen(str)-1; length>=0; length–)
{
int tchar = StringGetChar(s, length);
if((tchar > 96 && tchar < 123) || (tchar > 223 && tchar < 256)) s = StringSetChar(s, length, tchar - 32); else if(tchar > -33 && tchar < 0) s = StringSetChar(s, length, tchar + 224); } return(s); }