Jump to content

HH HL Indicator showing errors in experts file


Recommended Posts

Anyone can look at the decompiled code and tell me what is causing these errors in the experts log file ?

 

09:00:41 hhLhhllHll_alert~ EURUSDSB,M15: object name passed to ObjectSet function cannot be an uninitialized or empty string

 

[spoiler=decompiled file]#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 Green

#property indicator_color2 Red

#property indicator_color3 Green

#property indicator_color4 Red

 

extern bool SoundAlert = FALSE;

extern bool PopUpAlert = FALSE;

extern bool SendAlertEmail = FALSE;

double g_ibuf_88[];

double g_ibuf_92[];

double g_ibuf_96[];

double g_ibuf_100[];

int g_time_104 = 0;

double g_high_108;

double g_low_116;

 

int init() {

IndicatorBuffers(4);

SetIndexBuffer(0, g_ibuf_88);

SetIndexStyle(0, DRAW_HISTOGRAM);

SetIndexBuffer(1, g_ibuf_92);

SetIndexStyle(1, DRAW_HISTOGRAM);

SetIndexBuffer(2, g_ibuf_96);

SetIndexStyle(2, DRAW_HISTOGRAM);

SetIndexBuffer(3, g_ibuf_100);

SetIndexStyle(3, DRAW_HISTOGRAM);

return (0);

}

 

int deinit() {

string l_name_0;

int l_objs_total_8 = ObjectsTotal();

for (int li_12 = l_objs_total_8 - 1; li_12 >= 0; li_12--) {

l_name_0 = ObjectName(li_12);

if (StringFind(l_name_0, "hh") == 0 || StringFind(l_name_0, "ll") == 0) ObjectDelete(l_name_0);

}

return (0);

}

 

int start() {

string l_name_0;

string l_name_20;

string l_name_28;

int l_objs_total_8 = ObjectsTotal();

for (int li_12 = l_objs_total_8 - 1; li_12 >= 0; li_12--) {

l_name_0 = ObjectName(li_12);

if (StringFind(l_name_0, "hh") == 0 || StringFind(l_name_0, "ll") == 0) ObjectDelete(l_name_0);

}

int li_36 = IndicatorCounted();

if (li_36 < 0) li_36 = 0;

if (li_36 > 0) li_36--;

int li_16 = Bars - li_36;

for (li_12 = Bars; li_12 >= 1; li_12--) {

if (High[li_12] < High[li_12 + 2] && High[li_12 + 1] < High[li_12 + 2] && High[li_12 + 3] < High[li_12 + 2] && High[li_12 + 4] < High[li_12 + 2]) {

g_ibuf_100[li_12 + 2] = Low[li_12 + 2];

g_ibuf_96[li_12 + 2] = High[li_12 + 2];

g_high_108 = High[li_12 + 2];

ObjectSet(l_name_20, OBJPROP_TIME2, Time[li_12 + 2]);

l_name_20 = "hh" + ((Time[li_12 + 2]));

if (ObjectFind(l_name_20) == -1)

{

ObjectCreate(l_name_20, OBJ_TREND, 0, 0, 0, 0, 0);

ObjectSet(l_name_20, OBJPROP_TIME1, Time[li_12 + 2]);

ObjectSet(l_name_20, OBJPROP_TIME2, Time[li_12] + 60 * Period());

ObjectSet(l_name_20, OBJPROP_PRICE1, High[li_12 + 2]);

ObjectSet(l_name_20, OBJPROP_PRICE2, High[li_12 + 2]);

ObjectSet(l_name_20, OBJPROP_COLOR,Red);

ObjectSet(l_name_20, OBJPROP_WIDTH, 3);

ObjectSet(l_name_20, OBJPROP_RAY, FALSE);

}

if (Open[li_12 + 2] > Close[li_12 + 2]) {

g_ibuf_88[li_12 + 2] = Open[li_12 + 2];

g_ibuf_92[li_12 + 2] = Close[li_12 + 2];

}

if (Open[li_12 + 2] < Close[li_12 + 2]) {

g_ibuf_88[li_12 + 2] = Close[li_12 + 2];

g_ibuf_92[li_12 + 2] = Open[li_12 + 2];

}

} else ObjectSet(l_name_20, OBJPROP_TIME2, Time[li_12] + 60 * Period());

if (Low[li_12] > Low[li_12 + 2] && Low[li_12 + 1] > Low[li_12 + 2] && Low[li_12 + 3] > Low[li_12 + 2] && Low[li_12 + 4] > Low[li_12 + 2]) {

g_ibuf_100[li_12 + 2] = High[li_12 + 2];

g_ibuf_96[li_12 + 2] = Low[li_12 + 2];

g_low_116 = Low[li_12 + 2];

ObjectSet(l_name_28, OBJPROP_TIME2, Time[li_12 + 2]);

l_name_28 = "ll" + ((Time[li_12 + 2]));

if (ObjectFind(l_name_28) == -1) {

ObjectCreate(l_name_28, OBJ_TREND, 0, 0, 0, 0, 0);

ObjectSet(l_name_28, OBJPROP_TIME1, Time[li_12 + 2]);

ObjectSet(l_name_28, OBJPROP_TIME2, Time[li_12] + 60 * Period());

ObjectSet(l_name_28, OBJPROP_PRICE1, Low[li_12 + 2]);

ObjectSet(l_name_28, OBJPROP_PRICE2, Low[li_12 + 2]);

ObjectSet(l_name_28, OBJPROP_COLOR, Green);

ObjectSet(l_name_28, OBJPROP_WIDTH, 3);

ObjectSet(l_name_28, OBJPROP_RAY, FALSE);

}

if (Open[li_12 + 2] > Close[li_12 + 2]) {

g_ibuf_92[li_12 + 2] = Open[li_12 + 2];

g_ibuf_88[li_12 + 2] = Close[li_12 + 2];

}

if (Open[li_12 + 2] < Close[li_12 + 2]) {

g_ibuf_92[li_12 + 2] = Close[li_12 + 2];

g_ibuf_88[li_12 + 2] = Open[li_12 + 2];

}

} else ObjectSet(l_name_28, OBJPROP_TIME2, Time[li_12] + 60 * Period());

}

if (g_time_104 != Time[0]) {

if (Close[0] > g_high_108 && Close[1] <= g_high_108) {

g_time_104 = Time[0];

alert("HIGH crossed");

}

if (Close[0] < g_low_116 && Close[1] >= g_low_116) {

g_time_104 = Time[0];

alert("LOW crossed");

}

}

return (0);

}

 

void alert(string as_0) {

if (SoundAlert) PlaySound("alert.wav");

if (PopUpAlert) Alert("HL Alert - ", as_0, " on ", Symbol(), " at ", TimeToStr(TimeCurrent(), TIME_SECONDS));

if (SendAlertEmail) SendMail("hhLhhllHll alert", "hhLhhllHll alert - " + as_0 + " on " + Symbol() + " at " + TimeToStr(TimeCurrent(), TIME_SECONDS) + " (server time)");

}

 

Edited by shabz
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...