//-----------------------------------------------------------------
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DarkGoldenrod
#property indicator_color2 Blue
extern int ExtDepth = 12;
extern int ExtDeviation = 3;
extern int ExtBackstep = 2;
double g_ibuf_88[];
double g_ibuf_92[];
int g_time_96 = 0;
int gi_100;
int gi_104;
int gi_108;
double gd_112;
double gd_120;
double gd_128;
int init() {
IndicatorBuffers(2);
SetIndexStyle(0, DRAW_SECTION);
SetIndexBuffer(0, g_ibuf_88);
SetIndexBuffer(1, g_ibuf_92);
SetIndexEmptyValue(0, 0.0);
SetIndexEmptyValue(1, 0.0);
ArraySetAsSeries(g_ibuf_88, TRUE);
ArraySetAsSeries(g_ibuf_92, TRUE);
IndicatorShortName("WolfWave");
return (0);
}
int deinit() {
for (int li_0 = 1; li_0 <= 5; li_0++) ObjectDelete("WW" + "" + li_0);
ObjectDelete("WW" + "Line-2-4");
ObjectDelete("WW" + "Line-1-3");
ObjectDelete("WW" + "Line-1-4");
ObjectDelete("WW" + "Line-2-5");
return (0);
}
int start() {
double ld_0;
double ld_8;
double ld_16;
double ld_24;
double ld_32;
double ld_40;
int lia_48[200];
int lia_52[6];
int li_56;
int shift_60;
int li_64;
int li_68;
double ld_72;
double ld_80;
double ld_88;
double ld_96;
int li_104;
int li_108;
int li_112;
int li_116;
int li_120;
int li_124 = IndicatorCounted();
int li_unused_128 = 0;
string ls_132 = "None";
bool li_140 = FALSE;
if (Bars - 1 < ExtDepth) return (0);
if (li_124 < 0) return (-1);
if (li_124 > 0) li_124--;
int li_144 = Bars - ExtDepth;
if (li_124 == 0 || Bars - li_124 > 2) li_56 = li_144;
else {
shift_60 = iBarShift(NULL, 0, gi_100, TRUE);
li_64 = iBarShift(NULL, 0, gi_104, TRUE);
li_68 = iBarShift(NULL, 0, gi_108, TRUE);
li_56 = li_64;
if (shift_60 < 0 || li_64 < 0 || li_68 < 0) li_56 = li_144;
}
if (li_56 >= li_144 || g_time_96 != Time[Bars - 1]) {
g_time_96 = Time[Bars - 1];
for (int li_148 = Bars - 1; li_148 > 0; li_148--) {
g_ibuf_88[li_148] = 0.0;
g_ibuf_92[li_148] = 0.0;
}
li_56 = li_144;
}
for (li_148 = Bars - ExtDepth; li_148 >= 0; li_148--) {
ld_0 = Low[iLowest(NULL, 0, MODE_LOW, ExtDepth, li_148)];
if (ld_0 == ld_40) ld_0 = 0.0;
else {
ld_40 = ld_0;
if (Low[li_148] - ld_0 > ExtDeviation * Point) ld_0 = 0.0;
else {
for (int li_152 = 1; li_152 <= ExtBackstep; li_152++) {
ld_8 = g_ibuf_88[li_148 + li_152];
if (ld_8 != 0.0 && ld_8 > ld_0) g_ibuf_88[li_148 + li_152] = 0.0;
}
}
}
if (Low[li_148] == ld_0) g_ibuf_88[li_148] = ld_0;
ld_0 = High[iHighest(NULL, 0, MODE_HIGH, ExtDepth, li_148)];
if (ld_0 == ld_32) ld_0 = 0.0;
else {
ld_32 = ld_0;
if (ld_0 - High[li_148] > ExtDeviation * Point) ld_0 = 0.0;
else {
for (li_152 = 1; li_152 <= ExtBackstep; li_152++) {
ld_8 = g_ibuf_92[li_148 + li_152];
if (ld_8 != 0.0 && ld_8 < ld_0) g_ibuf_92[li_148 + li_152] = 0.0;
}
}
}
if (High[li_148] == ld_0) g_ibuf_92[li_148] = ld_0;
}
ld_32 = -1;
int li_156 = -1;
ld_40 = -1;
int li_160 = -1;
for (li_148 = Bars - ExtDepth; li_148 >= 0; li_148--) {
ld_16 = g_ibuf_88[li_148];
ld_24 = g_ibuf_92[li_148];
if (ld_16 == 0.0 && ld_24 == 0.0) continue;
if (ld_24 != 0.0) {
if (ld_32 > 0.0) {
if (ld_32 < ld_24) g_ibuf_92[li_156] = 0;
else g_ibuf_92[li_148] = 0;
}
if (ld_32 < ld_24 || ld_32 < 0.0) {
ld_32 = ld_24;
li_156 = li_148;
}
ld_40 = -1;
}
if (ld_16 != 0.0) {
if (ld_40 > 0.0) {
if (ld_40 > ld_16) g_ibuf_88[li_160] = 0;
else g_ibuf_88[li_148] = 0;
}
if (ld_16 < ld_40 || ld_40 < 0.0) {
ld_40 = ld_16;
li_160 = li_148;
}
ld_32 = -1;
}
}
for (li_148 = Bars - 1; li_148 >= 0; li_148--) {
if (li_148 >= Bars - ExtDepth) g_ibuf_88[li_148] = 0.0;
else {
ld_8 = g_ibuf_92[li_148];
if (ld_8 > 0.0) g_ibuf_88[li_148] = ld_8;
}
}
int index_164 = 0;
int index_168 = 0;
ld_8 = 0;
for (li_148 = 0; index_164 < 3; li_148++) {
if (g_ibuf_88[li_148] > 0.0) {
index_164++;
if (index_164 == 1 && g_ibuf_88[li_148] == High[li_148]) {
index_168 = li_148;
ld_8 = g_ibuf_88[li_148];
}
if (index_164 == 2 && ld_8 > 0.0 && g_ibuf_88[li_148] == High[li_148]) {
if (g_ibuf_88[li_148] >= g_ibuf_88[index_168]) g_ibuf_88[index_168] = 0;
else g_ibuf_88[li_148] = 0;
ld_8 = 0;
index_164 = 0;
index_168 = 0;
li_148 = 0;
}
}
}
if (li_56 < li_144) {
g_ibuf_88[shift_60] = gd_112;
g_ibuf_88[li_64] = gd_120;
g_ibuf_88[li_68] = gd_128;
for (int li_172 = li_68 - 1; li_172 > li_64; li_172--) g_ibuf_88[li_172] = 0;
for (int li_176 = li_64 - 1; li_176 > shift_60; li_176--) g_ibuf_88[li_176] = 0;
}
if (li_56 == li_144) li_68 = li_144;
for (int li_180 = li_68; li_180 >= 0; li_180--) {
if (g_ibuf_88[li_180] != 0.0) {
li_120++;
ld_96 = ld_88;
li_116 = li_112;
ld_88 = ld_80;
li_112 = li_108;
ld_80 = ld_72;
li_108 = li_104;
ld_72 = g_ibuf_88[li_180];
li_104 = li_180;
if (li_120 >= 3) {
if (ld_88 < ld_80 && ld_80 < ld_72) {
g_ibuf_88[li_108] = 0;
li_180 = li_112 + 1;
}
if (ld_88 > ld_80 && ld_80 > ld_72) {
g_ibuf_88[li_108] = 0;
li_180 = li_112 + 1;
}
if (ld_80 == ld_72 && ld_72 != 0.0) {
g_ibuf_88[li_104] = 0;
li_180 = li_112 + 1;
}
}
}
}
gi_100 = Time[li_108];
gi_104 = Time[li_112];
gi_108 = Time[li_116];
gd_112 = ld_80;
gd_120 = ld_88;
gd_128 = ld_96;
index_164 = 0;
for (int index_184 = 0; index_184 < Bars && index_164 < 200; index_184++) {
if (g_ibuf_88[index_184] != 0.0 || g_ibuf_92[index_184] != 0.0) {
lia_48[index_164] = index_184;
index_164++;
}
}
for (index_168 = 0; index_168 < index_164 && index_168 < 200 && li_140 == FALSE; index_168++) {
lia_52[1] = lia_48[index_168 + 4];
lia_52[2] = lia_48[index_168 + 3];
lia_52[3] = lia_48[index_168 + 2];
lia_52[4] = lia_48[index_168 + 1];
lia_52[5] = lia_48[index_168 + 0];
if (Low[lia_52[1]] < High[lia_52[2]] && Low[lia_52[3]] < Low[lia_52[1]] && Low[lia_52[3]] < High[lia_52[4]]) ls_132 = "Buy";
else {
if (High[lia_52[1]] > Low[lia_52[2]] && High[lia_52[3]] > High[lia_52[1]] && High[lia_52[3]] > Low[lia_52[4]]) ls_132 = "Sell";
else ls_132 = "Not";
}
if (ls_132 == "Buy") {
ObjectCreate("WW" + "Line-1-3", OBJ_TREND, 0, Time[lia_52[1]], Low[lia_52[1]], Time[lia_52[3]], Low[lia_52[3]]);
ObjectSet("WW" + "Line-1-3", OBJPROP_COLOR, Teal);
ObjectSet("WW" + "Line-1-3", OBJPROP_WIDTH, 1);
if (ObjectGetValueByShift("WW" + "Line-1-3", lia_52[3]) >= Low[lia_52[3]]) {
ObjectCreate("WW" + "1", OBJ_ARROW, 0, Time[lia_52[1]], Low[lia_52[1]] - 2.0 * Point);
ObjectSet("WW" + "1", OBJPROP_ARROWCODE, 140);
ObjectSet("WW" + "1", OBJPROP_COLOR, White);
ObjectCreate("WW" + "2", OBJ_ARROW, 0, Time[lia_52[2]], High[lia_52[2]] + 8.0 * Point);
ObjectSet("WW" + "2", OBJPROP_ARROWCODE, 141);
ObjectSet("WW" + "2", OBJPROP_COLOR, White);
ObjectCreate("WW" + "3", OBJ_ARROW, 0, Time[lia_52[3]], Low[lia_52[3]] - 2.0 * Point);
ObjectSet("WW" + "3", OBJPROP_ARROWCODE, 142);
ObjectSet("WW" + "3", OBJPROP_COLOR, White);
ObjectCreate("WW" + "4", OBJ_ARROW, 0, Time[lia_52[4]], High[lia_52[4]] + 8.0 * Point);
ObjectSet("WW" + "4", OBJPROP_ARROWCODE, 143);
ObjectSet("WW" + "4", OBJPROP_COLOR, White);
ObjectCreate("WW" + "5", OBJ_ARROW, 0, Time[lia_52[5]], Low[lia_52[5]] - 2.0 * Point);
ObjectSet("WW" + "5", OBJPROP_ARROWCODE, 144);
ObjectSet("WW" + "5", OBJPROP_COLOR, White);
ObjectCreate("WW" + "Line-1-4", OBJ_TREND, 0, Time[lia_52[1]], Low[lia_52[1]], Time[lia_52[4]], High[lia_52[4]]);
ObjectSet("WW" + "Line-1-4", OBJPROP_COLOR, Chocolate);
ObjectSet("WW", OBJPROP_STYLE, STYLE_DOT);
ObjectSet("WW" + "Line-1-4", OBJPROP_WIDTH, 0);
ObjectSet("WW" + "Line-1-4", OBJPROP_BACK, FALSE);
ObjectSet("WW" + "Line-2-5", OBJPROP_BACK, FALSE);
}
} else {
if (ls_132 == "Sell") {
ObjectCreate("WW" + "Line-1-3", OBJ_TREND, 0, Time[lia_52[1]], High[lia_52[1]], Time[lia_52[3]], High[lia_52[3]]);
ObjectSet("WW" + "Line-1-3", OBJPROP_COLOR, Teal);
ObjectSet("WW" + "Line-1-3", OBJPROP_WIDTH, 0);
if (ObjectGetValueByShift("WW" + "Line-1-3", lia_52[3]) <= High[lia_52[3]]) {
ObjectCreate("WW" + "1", OBJ_ARROW, 0, Time[lia_52[1]], High[lia_52[1]] + 8.0 * Point);
ObjectSet("WW" + "1", OBJPROP_ARROWCODE, 140);
ObjectSet("WW" + "1", OBJPROP_COLOR, White);
ObjectCreate("WW" + "2", OBJ_ARROW, 0, Time[lia_52[2]], Low[lia_52[2]] - 2.0 * Point);
ObjectSet("WW" + "2", OBJPROP_ARROWCODE, 141);
ObjectSet("WW" + "2", OBJPROP_COLOR, White);
ObjectCreate("WW" + "3", OBJ_ARROW, 0, Time[lia_52[3]], High[lia_52[3]] + 8.0 * Point);
ObjectSet("WW" + "3", OBJPROP_ARROWCODE, 142);
ObjectSet("WW" + "3", OBJPROP_COLOR, White);
ObjectCreate("WW" + "4", OBJ_ARROW, 0, Time[lia_52[4]], Low[lia_52[4]] - 2.0 * Point);
ObjectSet("WW" + "4", OBJPROP_ARROWCODE, 143);
ObjectSet("WW" + "4", OBJPROP_COLOR, White);
ObjectSet("WW" + "4", OBJPROP_BACK, TRUE);
ObjectCreate("WW" + "5", OBJ_ARROW, 0, Time[lia_52[5]], High[lia_52[5]] + 8.0 * Point);
ObjectSet("WW" + "5", OBJPROP_ARROWCODE, 144);
ObjectSet("WW" + "5", OBJPROP_COLOR, White);
ObjectCreate("WW" + "Line-1-4", OBJ_TREND, 0, Time[lia_52[1]], High[lia_52[1]], Time[lia_52[4]], Low[lia_52[4]]);
ObjectSet("WW" + "Line-1-4", OBJPROP_COLOR, Chocolate);
ObjectSet("WW", OBJPROP_STYLE, STYLE_DOT);
ObjectSet("WW" + "Line-1-4", OBJPROP_WIDTH, 1);
ObjectSet("WW" + "Line-1-4", OBJPROP_BACK, FALSE);
}
WindowRedraw();
}
}
}
return (0);
} |