Jump to content

GreenLand


4xmeter

Recommended Posts

It is the same as the one below. However, this one is better. If you like Fibos then go to you tube and type Bobokus. He is the original author. You would learn 2 or 3 things with this dude.

 

#property link "Modified by cja"

 

#property indicator_chart_window

#property indicator_buffers 3

#property indicator_color1 Black

#property indicator_color2 Black

#property indicator_color3 Black

 

extern int TimeFrame = 60;

extern int Fibo_Num = 12345;

extern color Intra_color = RoyalBlue;

extern color Upper_color = Blue;

extern color Lower_color = DodgerBlue;

double g_price_96;

double g_price_104;

double gd_112;

int g_datetime_120;

 

int init() {

return (0);

}

 

int deinit() {

ObjectDelete("LongFibo" + Fibo_Num + "");

ObjectDelete("ShortFibo" + Fibo_Num + "");

ObjectDelete("IntradayFibo" + Fibo_Num + "");

ObjectDelete("Fibo" + Fibo_Num + "");

ObjectDelete("Fibo1" + Fibo_Num + "");

return (0);

}

 

int DrawFibo() {

string ls_0 = "";

string ls_8 = "";

if (TimeFrame == PERIOD_M1) return (-1);

if (TimeFrame == PERIOD_M5) return (-1);

if (TimeFrame == PERIOD_M15) return (-1);

if (TimeFrame == PERIOD_M30) return (-1);

if (TimeFrame == PERIOD_H1) ls_0 = "H1";

if (TimeFrame == PERIOD_H4) ls_0 = "H4";

if (TimeFrame == PERIOD_D1) ls_0 = "Daily";

if (TimeFrame == PERIOD_W1) ls_0 = "Weekly";

if (TimeFrame == PERIOD_MN1) ls_0 = "Monthly";

if (TimeFrame == PERIOD_H1) ls_8 = "1 Hourly";

if (TimeFrame == PERIOD_H4) ls_8 = "4 Hourly";

if (TimeFrame == PERIOD_D1) ls_8 = "IntraDay";

if (TimeFrame == PERIOD_W1) ls_8 = "IntraWeek";

if (TimeFrame == PERIOD_MN1) ls_8 = "IntraMonth";

if (ObjectFind("LongFibo" + Fibo_Num + "") == -1) ObjectCreate("LongFibo" + Fibo_Num + "", OBJ_FIBO, 0, g_datetime_120, g_price_96 + gd_112, g_datetime_120, g_price_96);

else {

ObjectSet("LongFibo" + Fibo_Num + "", OBJPROP_TIME2, g_datetime_120);

ObjectSet("LongFibo" + Fibo_Num + "", OBJPROP_TIME1, g_datetime_120);

ObjectSet("LongFibo" + Fibo_Num + "", OBJPROP_PRICE1, g_price_96 + gd_112);

ObjectSet("LongFibo" + Fibo_Num + "", OBJPROP_PRICE2, g_price_96);

}

ObjectSet("LongFibo" + Fibo_Num + "", OBJPROP_LEVELCOLOR, Upper_color);

ObjectSet("LongFibo" + Fibo_Num + "", OBJPROP_FIBOLEVELS, 4);

ObjectSet("LongFibo" + Fibo_Num + "", OBJPROP_FIRSTLEVEL, 0.34);

ObjectSetFiboDescription("LongFibo" + Fibo_Num + "", 0, "" + ls_0 + " Long Target 1 - %$");

ObjectSet("LongFibo" + Fibo_Num + "", 211, 0.55);

ObjectSetFiboDescription("LongFibo" + Fibo_Num + "", 1, "" + ls_0 + " Long Target 2 - %$");

ObjectSet("LongFibo" + Fibo_Num + "", 212, 0.764);

ObjectSetFiboDescription("LongFibo" + Fibo_Num + "", 2, "" + ls_0 + " Long Target 3 - %$");

ObjectSet("LongFibo" + Fibo_Num + "", 213, 1.764);

ObjectSetFiboDescription("LongFibo" + Fibo_Num + "", 3, "" + ls_0 + " Long Target 4 - %$");

ObjectSet("LongFibo" + Fibo_Num + "", OBJPROP_RAY, TRUE);

ObjectSet("LongFibo" + Fibo_Num + "", OBJPROP_BACK, TRUE);

if (ObjectFind("ShortFibo" + Fibo_Num + "") == -1) ObjectCreate("ShortFibo" + Fibo_Num + "", OBJ_FIBO, 0, g_datetime_120, g_price_104 - gd_112, g_datetime_120, g_price_104);

else {

ObjectSet("ShortFibo" + Fibo_Num + "", OBJPROP_TIME2, g_datetime_120);

ObjectSet("ShortFibo" + Fibo_Num + "", OBJPROP_TIME1, g_datetime_120);

ObjectSet("ShortFibo" + Fibo_Num + "", OBJPROP_PRICE1, g_price_104 - gd_112);

ObjectSet("ShortFibo" + Fibo_Num + "", OBJPROP_PRICE2, g_price_104);

}

ObjectSet("ShortFibo" + Fibo_Num + "", OBJPROP_LEVELCOLOR, Lower_color);

ObjectSet("ShortFibo" + Fibo_Num + "", OBJPROP_FIBOLEVELS, 4);

ObjectSet("ShortFibo" + Fibo_Num + "", OBJPROP_FIRSTLEVEL, 0.34);

ObjectSetFiboDescription("ShortFibo" + Fibo_Num + "", 0, "" + ls_0 + " Short Target 1 - %$");

ObjectSet("ShortFibo" + Fibo_Num + "", 211, 0.55);

ObjectSetFiboDescription("ShortFibo" + Fibo_Num + "", 1, "" + ls_0 + " Short Target 2 - %$");

ObjectSet("ShortFibo" + Fibo_Num + "", 212, 0.764);

ObjectSetFiboDescription("ShortFibo" + Fibo_Num + "", 2, "" + ls_0 + " Short Target 3 - %$");

ObjectSet("ShortFibo" + Fibo_Num + "", 213, 1.764);

ObjectSetFiboDescription("ShortFibo" + Fibo_Num + "", 3, "" + ls_0 + " Short Target 4 - %$");

ObjectSet("ShortFibo" + Fibo_Num + "", OBJPROP_RAY, TRUE);

ObjectSet("ShortFibo" + Fibo_Num + "", OBJPROP_BACK, TRUE);

if (ObjectFind("IntradayFibo" + Fibo_Num + "") == -1) ObjectCreate("IntradayFibo" + Fibo_Num + "", OBJ_FIBO, 0, g_datetime_120, g_price_96, g_datetime_120 + 60 * TimeFrame, g_price_104);

else {

ObjectSet("IntradayFibo" + Fibo_Num + "", OBJPROP_TIME2, g_datetime_120);

ObjectSet("IntradayFibo" + Fibo_Num + "", OBJPROP_TIME1, g_datetime_120 + 60 * TimeFrame);

ObjectSet("IntradayFibo" + Fibo_Num + "", OBJPROP_PRICE1, g_price_96);

ObjectSet("IntradayFibo" + Fibo_Num + "", OBJPROP_PRICE2, g_price_104);

}

ObjectSet("IntradayFibo" + Fibo_Num + "", OBJPROP_LEVELCOLOR, Intra_color);

ObjectSet("IntradayFibo" + Fibo_Num + "", OBJPROP_FIBOLEVELS, 7);

ObjectSet("IntradayFibo" + Fibo_Num + "", OBJPROP_FIRSTLEVEL, 0.0);

ObjectSetFiboDescription("IntradayFibo" + Fibo_Num + "", 0, "" + ls_8 + " Low - %$");

ObjectSet("IntradayFibo" + Fibo_Num + "", 211, 0.191);

ObjectSetFiboDescription("IntradayFibo" + Fibo_Num + "", 1, "" + ls_8 + " S1 - %$");

ObjectSet("IntradayFibo" + Fibo_Num + "", 212, 0.382);

ObjectSetFiboDescription("IntradayFibo" + Fibo_Num + "", 2, "" + ls_8 + " Short - %$");

ObjectSet("IntradayFibo" + Fibo_Num + "", 213, 0.5);

ObjectSetFiboDescription("IntradayFibo" + Fibo_Num + "", 3, "" + ls_8 + " Pivot - %$");

ObjectSet("IntradayFibo" + Fibo_Num + "", 214, 0.618);

ObjectSetFiboDescription("IntradayFibo" + Fibo_Num + "", 4, "" + ls_8 + " Long - %$");

ObjectSet("IntradayFibo" + Fibo_Num + "", 215, 0.809);

ObjectSetFiboDescription("IntradayFibo" + Fibo_Num + "", 5, "" + ls_8 + " R1 - %$");

ObjectSet("IntradayFibo" + Fibo_Num + "", 216, 1.0);

ObjectSetFiboDescription("IntradayFibo" + Fibo_Num + "", 6, "" + ls_8 + " High - %$");

ObjectSet("IntradayFibo" + Fibo_Num + "", OBJPROP_RAY, TRUE);

ObjectSet("IntradayFibo" + Fibo_Num + "", OBJPROP_BACK, TRUE);

return (0);

}

 

int start() {

int li_0 = iBarShift(NULL, TimeFrame, Time[0]) + 1;

g_price_96 = iHigh(NULL, TimeFrame, li_0);

g_price_104 = iLow(NULL, TimeFrame, li_0);

g_datetime_120 = iTime(NULL, TimeFrame, li_0);

if (TimeDayOfWeek(g_datetime_120) == 0) {

g_price_96 = MathMax(g_price_96, iHigh(NULL, TimeFrame, li_0 + 1));

g_price_104 = MathMin(g_price_104, iLow(NULL, TimeFrame, li_0 + 1));

}

gd_112 = g_price_96 - g_price_104;

DrawFibo();

string l_text_4 = "";

string l_text_12 = "";

if (TimeFrame == PERIOD_M1) {

l_text_4 = "ERROR: Incorrect Fibo TimeFrame";

l_text_12 = "Use only H1/H4/D1/W1/MN1";

}

if (TimeFrame == PERIOD_M5) {

l_text_4 = "ERROR: Incorrect Fibo TimeFrame";

l_text_12 = "Use only H1/H4/D1/W1/MN1";

}

if (TimeFrame == PERIOD_M15) {

l_text_4 = "ERROR: Incorrect Fibo TimeFrame";

l_text_12 = "Use only H1/H4/D1/W1/MN1";

}

if (TimeFrame == PERIOD_M30) {

l_text_4 = "ERROR: Incorrect Fibo TimeFrame";

l_text_12 = "Use only H1/H4/D1/W1/MN1";

}

ObjectDelete("Fibo" + Fibo_Num + "");

ObjectCreate("Fibo" + Fibo_Num + "", OBJ_LABEL, 0, 0, 0);

ObjectSetText("Fibo" + Fibo_Num + "", l_text_4, 20, "Verdana", Intra_color);

ObjectSet("Fibo" + Fibo_Num + "", OBJPROP_CORNER, 1);

ObjectSet("Fibo" + Fibo_Num + "", OBJPROP_XDISTANCE, 20);

ObjectSet("Fibo" + Fibo_Num + "", OBJPROP_YDISTANCE, 36);

ObjectDelete("Fibo1" + Fibo_Num + "");

ObjectCreate("Fibo1" + Fibo_Num + "", OBJ_LABEL, 0, 0, 0);

ObjectSetText("Fibo1" + Fibo_Num + "", l_text_12, 20, "Verdana", Intra_color);

ObjectSet("Fibo1" + Fibo_Num + "", OBJPROP_CORNER, 1);

ObjectSet("Fibo1" + Fibo_Num + "", OBJPROP_XDISTANCE, 20);

ObjectSet("Fibo1" + Fibo_Num + "", OBJPROP_YDISTANCE, 66);

return (0);

}

Link to comment
Share on other sites

Hi Hagar if you like fibo here is another one; also you could put it as you default fibo, and choose any range with it.

 

 

SquidsterFiboBreak

 

#property indicator_chart_window

#property indicator_buffers 3

#property indicator_color1 Red

#property indicator_color2 Aqua

#property indicator_color3 Yellow

 

extern int DisplayFiboDay = 0;

double g_price_80;

double g_price_88;

int g_width_96 = 1;

extern color colour = Crimson;

int gi_104 = 2;

double gda_108[13];

double g_ibuf_112[];

double gda_116[13];

string gsa_120[13];

double g_ibuf_124[];

double g_ibuf_128[];

double g_iopen_132;

int gi_140;

int g_count_144;

 

int init() {

SetIndexLabel(1, "High");

SetIndexStyle(1, DRAW_HISTOGRAM);

SetIndexBuffer(1, g_ibuf_124);

SetIndexLabel(2, "Low");

SetIndexStyle(2, DRAW_HISTOGRAM);

SetIndexBuffer(2, g_ibuf_128);

SetIndexStyle(0, DRAW_LINE);

SetIndexBuffer(0, g_ibuf_112);

gda_116[0] = -1.618;

gda_116[1] = -1.382;

gda_116[2] = -0.618;

gda_116[3] = -0.382;

gda_116[4] = 0.0;

gda_116[5] = 0.382;

gda_116[6] = 0.5;

gda_116[7] = 0.618;

gda_116[8] = 1.0;

gda_116[9] = 1.382;

gda_116[10] = 1.618;

gda_116[11] = 2.382;

gda_116[12] = 2.618;

gsa_120[0] = "Swing T4";

gsa_120[1] = "Swing T3";

gsa_120[2] = "Swing T2";

gsa_120[3] = "Swing T1";

gsa_120[4] = "Swing Low";

gsa_120[5] = "Swing Short";

gsa_120[6] = "Swing Pivot";

gsa_120[7] = "Swing Long";

gsa_120[8] = "Swing High";

gsa_120[9] = "Swing T1";

gsa_120[10] = "Swing T2";

gsa_120[11] = "Swing T3";

gsa_120[12] = "Swing T4";

return (0);

}

 

int deinit() {

ObjectsDeleteAll(0, OBJ_FIBO);

return (0);

}

 

int start() {

int li_0;

double l_ihigh_8;

double l_ilow_16;

double l_iopen_24;

double l_iclose_32;

double ld_40;

double ld_48;

double ld_56;

double ld_64;

double ld_72;

double l_iopen_80;

double l_iclose_88;

double ld_96;

double ld_unused_104;

double ld_unused_112;

double ld_120;

g_iopen_132 = iOpen(Symbol(), PERIOD_D1, DisplayFiboDay);

for (int li_4 = Bars - IndicatorCounted(); li_4 >= 0; li_4--) {

if (TimeHour(iTime(NULL, 0, li_4)) != 0) {

g_ibuf_124[li_4] = g_ibuf_124[li_4 + 1];

g_ibuf_128[li_4] = g_ibuf_128[li_4 + 1];

} else {

li_0 = iBarShift(Symbol(), PERIOD_D1, Time[li_4]) + 1;

l_ihigh_8 = iHigh(NULL, PERIOD_D1, li_0);

l_ilow_16 = iLow(NULL, PERIOD_D1, li_0);

l_iopen_24 = iOpen(NULL, PERIOD_D1, li_0);

l_iclose_32 = iClose(NULL, PERIOD_D1, li_0);

if (l_iclose_32 < l_iopen_24) ld_40 = l_ihigh_8 + 2.0 * l_ilow_16 + l_iclose_32;

else {

if (l_iclose_32 > l_iopen_24) ld_40 = 2.0 * l_ihigh_8 + l_ilow_16 + l_iclose_32;

else

if (l_iclose_32 == l_iopen_24) ld_40 = l_ihigh_8 + l_ilow_16 + 2.0 * l_iclose_32;

}

ld_48 = ld_40 / 2.0 - l_ilow_16;

ld_56 = ld_40 / 2.0 - l_ihigh_8;

ld_64 = ld_48;

ld_72 = ld_56;

l_iopen_80 = l_iopen_24;

l_iclose_88 = l_iclose_32;

if (l_iclose_88 < l_iopen_80) ld_96 = ld_64 + 2.0 * ld_72 + l_iclose_88;

else {

if (l_iclose_88 > l_iopen_80) ld_96 = 2.0 * ld_64 + ld_72 + l_iclose_88;

else

if (l_iclose_88 == l_iopen_80) ld_96 = ld_64 + ld_72 + 2.0 * l_iclose_88;

}

ld_unused_104 = g_ibuf_124[li_4];

ld_unused_112 = g_ibuf_128[li_4];

g_ibuf_124[li_4] = ld_96 / 2.0 - ld_72;

g_ibuf_128[li_4] = ld_96 / 2.0 - ld_64;

}

}

int l_datetime_128 = iTime(Symbol(), PERIOD_D1, DisplayFiboDay);

for (li_4 = 0; li_4 < Bars; li_4++) {

if (Time[li_4] < l_datetime_128) {

g_price_80 = g_ibuf_128[li_4];

g_price_88 = g_ibuf_124[li_4];

ld_120 = g_price_88 - g_price_80;

for (int li_132 = 0; li_132 < 13; li_132++) gda_108[li_132] = g_price_80 + ld_120 * gda_116[li_132];

if (gda_108[5] < g_iopen_132 && gda_108[7] > g_iopen_132) break;

}

}

if (li_4 == Bars) {

Comment("Error! Day not found");

return;

}

string ls_136 = StringSubstr(TimeToStr(Time[li_4]), 0, 10);

gsa_120[6] = "Pivot";

g_price_80 = g_ibuf_128[li_4];

g_price_88 = g_ibuf_124[li_4];

ld_120 = g_price_88 - g_price_80;

for (li_132 = 0; li_132 < 13; li_132++) gda_108[li_132] = g_price_80 + ld_120 * gda_116[li_132];

int l_shift_144 = iBarShift(NULL, 0, StrToTime(TimeToStr(l_datetime_128, TIME_DATE) + " 00:00"));

ObjectDelete("fibo-alert");

ObjectCreate("fibo-alert", OBJ_FIBO, 0, Time[l_shift_144], g_price_88, Time[l_shift_144], g_price_80);

ObjectSet("fibo-alert", OBJPROP_COLOR, colour);

ObjectSet("fibo-alert", OBJPROP_WIDTH, g_width_96);

ObjectSet("fibo-alert", OBJPROP_STYLE, STYLE_DOT);

ObjectSet("fibo-alert", OBJPROP_FIBOLEVELS, 13);

ObjectSet("fibo-alert", OBJPROP_LEVELCOLOR, colour);

ObjectSet("fibo-alert", OBJPROP_LEVELSTYLE, STYLE_SOLID);

for (li_132 = 0; li_132 < 13; li_132++) {

ObjectSet("fibo-alert", li_132 + 210, gda_116[li_132]);

ObjectSetFiboDescription("fibo-alert", li_132, gsa_120[li_132] + " " + DoubleToStr(100.0 * gda_116[li_132], 1) + " " + DoubleToStr(gda_108[li_132], Digits));

}

if (Month() > 9) {

ObjectsDeleteAll(0, OBJ_FIBO);

Alert("This indicator has expired. Wrong signals will be given");

}

if (gi_140 != Time[0]) {

if (Close[1] > gda_108[7] && Open[1] <= gda_108[7]) {

g_count_144++;

if (g_count_144 >= gi_104) {

g_count_144 = 0;

gi_140 = Time[0];

}

}

if (Close[1] < gda_108[5] && Open[1] >= gda_108[5]) {

g_count_144++;

if (g_count_144 >= gi_104) {

g_count_144 = 0;

gi_140 = Time[0];

}

}

}

return (0);

}

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...