#property copyright "Copyright © 2008, Кузинок Сергей "
#property link "Кузинок Сергей"
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 MediumBlue
#property indicator_color3 Red
#property indicator_color4 MediumBlue
#property indicator_color5 Blue
#property indicator_color6 Red
extern int MaMetod = 3;
extern int MaPeriod = 11;
extern bool Signal = TRUE;
extern bool Mail = FALSE;
extern int Step = 5;
extern color Bars_Color_UP = Red;
extern color Bars_Color_DOWN = MediumBlue;
double g_ibuf_104[];
double g_ibuf_108[];
double g_ibuf_112[];
double g_ibuf_116[];
double g_ibuf_120[];
double g_ibuf_124[];
double gd_128;
string gs_null_136 = "NULL";
string gs_null_144 = "NULL";
int gi_152 = 0;
int init() {
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 1, Bars_Color_UP);
SetIndexBuffer(0, g_ibuf_104);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 1, Bars_Color_DOWN);
SetIndexBuffer(1, g_ibuf_108);
SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 2, Bars_Color_UP);
SetIndexBuffer(2, g_ibuf_112);
SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 2, Bars_Color_DOWN);
SetIndexBuffer(3, g_ibuf_116);
SetIndexStyle(4, DRAW_ARROW, STYLE_SOLID, 1);
SetIndexBuffer(4, g_ibuf_120);
SetIndexArrow(4, 233);
SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, 1);
SetIndexBuffer(5, g_ibuf_124);
SetIndexArrow(5, 234);
SetIndexDrawBegin(0, 5);
SetIndexBuffer(0, g_ibuf_104);
SetIndexBuffer(1, g_ibuf_108);
SetIndexBuffer(2, g_ibuf_112);
SetIndexBuffer(3, g_ibuf_116);
return (0);
}
int deinit() {
return (0);
}
int start() {
double l_ima_0;
double l_ima_8;
double l_ima_16;
double l_ima_24;
double ld_unused_32;
double ld_unused_40;
double ld_48;
double ld_56;
double ld_64;
double ld_72;
if (Bars <= 10) return (0);
gi_152 = IndicatorCounted();
if (gi_152 < 0) return (-1);
if (gi_152 > 0) gi_152--;
for (int li_96 = Bars - gi_152 - 1; li_96 >= 0; li_96--) {
l_ima_0 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_CLOSE, li_96);
l_ima_8 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_LOW, li_96);
l_ima_16 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_OPEN, li_96);
l_ima_24 = iMA(NULL, 0, MaPeriod, 0, MaMetod, PRICE_HIGH, li_96);
ld_48 = (g_ibuf_112[li_96 + 1] + (g_ibuf_116[li_96 + 1])) / 2.0;
ld_72 = (l_ima_0 + l_ima_24 + l_ima_16 + l_ima_8) / 4.0;
ld_56 = MathMax(l_ima_24, MathMax(ld_48, ld_72));
ld_64 = MathMin(l_ima_16, MathMin(ld_48, ld_72));
ld_unused_32 = iMA(NULL, 0, 30, 1, MODE_SMA, PRICE_LOW, li_96);
ld_unused_40 = iMA(NULL, 0, 30, 1, MODE_SMA, PRICE_LOW, li_96 - 1);
if (ld_48 < ld_72) {
g_ibuf_104[li_96] = ld_64;
if (g_ibuf_104[li_96] < g_ibuf_108[li_96] && g_ibuf_104[li_96 + 1] < g_ibuf_108[li_96 + 1] && g_ibuf_104[li_96 + 2] > g_ibuf_108[li_96 + 2]) {
g_ibuf_120[li_96] = ld_64 - 5.0 * Point;
if (li_96 == 0) gs_null_136 = "BUY";
}
g_ibuf_108[li_96] = ld_56;
} else {
g_ibuf_104[li_96] = ld_56;
g_ibuf_108[li_96] = ld_64;
if (g_ibuf_104[li_96] > g_ibuf_108[li_96] && g_ibuf_104[li_96 + 1] > g_ibuf_108[li_96 + 1] && g_ibuf_104[li_96 + 2] < g_ibuf_108[li_96 + 2]) {
g_ibuf_124[li_96] = ld_64 + 5.0 * Point;
if (li_96 == 0) gs_null_136 = "SELL";
}
}
g_ibuf_112[li_96] = ld_48;
g_ibuf_116[li_96] = ld_72;
}
if (gs_null_144 != gs_null_136) {
gs_null_144 = gs_null_136;
if (gs_null_136 == "BUY") gd_128 = NormalizeDouble(Step * Point + Ask, 4);
if (gs_null_136 == "SELL") gd_128 = NormalizeDouble(Step * Point + Bid, 4);
if (Signal == TRUE) {
Alert("Поступил новый сигнал: " + gs_null_136
+ "\n"
+ "Дата: " + TimeDay(TimeLocal()) + "." + TimeMonth(TimeLocal()) + "." + TimeYear(TimeLocal())
+ "\n"
+ "Валютная пара: " + Symbol()
+ "\n"
+ "Таймфрейм: " + Period()
+ "\n"
+ "Цена открытия: " + gd_128);
}
if (Mail == TRUE) {
SendMail("Новый сигнал STS", "Поступил новый сигнал: " + gs_null_136
+ "\n"
+ "Дата: " + TimeDay(TimeLocal()) + "." + TimeMonth(TimeLocal()) + "." + TimeYear(TimeLocal())
+ "\n"
+ "Валютная пара: " + Symbol()
+ "\n"
+ "Таймфрейм: " + Period()
+ "\n"
+ "Цена открытия: " + gd_128);
Print(GetLastError());
}
}
return (0);
}
Thunder61