Upotrebi ovaj indikator i Schaff i to bi bila odlična kombinacija
#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 1.0
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 Red
extern int period = 16;
extern bool alarm = TRUE;
extern int nBars = 500;
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double g_bars_100;
double gd_108;
int init() {
IndicatorDigits(0);
IndicatorBuffers(3);
SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, 4, White);
SetIndexBuffer(0, g_ibuf_92);
SetIndexStyle(1, DRAW_HISTOGRAM, EMPTY, 4, Red);
SetIndexBuffer(1, g_ibuf_96);
SetIndexBuffer(2, g_ibuf_88);
IndicatorShortName("SSL16TS" + " (" + period + ")");
SetIndexLabel(0, "Trend UP");
SetIndexLabel(1, "Trend DN");
return (0);
}
int start() {
double ld_12;
double ld_36;
double ld_4 = 0;
double ld_20 = 0;
double ld_28 = 0;
double l_low_44 = 0;
double l_high_52 = 0;
int li_0 = nBars;
for (int li_60 = 0; li_60 < li_0; li_60++) {
l_high_52 = High[iHighest(NULL, 0, MODE_HIGH, period, li_60)];
l_low_44 = Low[iLowest(NULL, 0, MODE_LOW, period, li_60)];
ld_36 = (High[li_60] + Low[li_60]) / 2.0;
if (l_high_52 - l_low_44 == 0.0) ld_20 = 0.67 * ld_4 + (-0.33);
else ld_20 = 0.66 * ((ld_36 - l_low_44) / (l_high_52 - l_low_44) - 0.5) + 0.67 * ld_4;
ld_20 = MathMin(MathMax(ld_20, -0.999), 0.999);
if (1 - ld_20 == 0.0) g_ibuf_88[li_60] = ld_28 / 2.0 + 0.5;
else g_ibuf_88[li_60] = MathLog((ld_20 + 1.0) / (1 - ld_20)) / 2.0 + ld_28 / 2.0;
ld_4 = ld_20;
ld_28 = g_ibuf_88[li_60];
}
bool li_64 = TRUE;
for (int li_68 = li_0 - 1; li_68 >= 0; li_68--) {
ld_12 = g_ibuf_88[li_68];
ld_4 = g_ibuf_88[li_68 + 1];
if ((ld_12 < 0.0 && ld_4 > 0.0) || ld_12 < 0.0) li_64 = FALSE;
if ((ld_12 > 0.0 && ld_4 < 0.0) || ld_12 > 0.0) li_64 = TRUE;
if (li_64) {
g_ibuf_92[li_68] = 1.0;
g_ibuf_96[li_68] = EMPTY_VALUE;
if (alarm == TRUE) {
if (li_68 == 0 && ld_4 != 2.0 && g_ibuf_92[li_68] == 1.0 && Bars > g_bars_100) {
Alert("(smVorti) Trend Changing Down on ", Period(), " ", Symbol());
g_bars_100 = Bars;
gd_108 = 2;
}
}
} else {
g_ibuf_96[li_68] = 1.0;
g_ibuf_92[li_68] = EMPTY_VALUE;
if (alarm == TRUE) {
if (li_68 == 0 && gd_108 != 1.0 && g_ibuf_96[li_68] == 1.0 && Bars > g_bars_100) {
Alert("(smVorti) Trend Changing Up on ", Period(), " ", Symbol());
g_bars_100 = Bars;
gd_108 = 1;
}
}
}
}
return (0);
}