Jump to content

(Req) WaveTrend


Recommended Posts

/*

Generated by EX4-TO-MQ4 decompiler V4.0.224.1h []

Website: http://purebeam.biz

E-mail : [email protected]

*/

 

#property indicator_separate_window

#property indicator_minimum -100.0

#property indicator_maximum 100.0

#property indicator_levelcolor SlateGray

#property indicator_levelstyle 1

#property indicator_buffers 8

#property indicator_color1 Lime

#property indicator_color2 Red

#property indicator_color3 Black

#property indicator_color4 Black

#property indicator_color5 Black

#property indicator_color6 Black

#property indicator_color7 Black

#property indicator_color8 Black

#property indicator_width1 1

#property indicator_level1 60.0

#property indicator_width2 1

#property indicator_level2 53.0

#property indicator_level3 -50.0

#property indicator_level4 -60.0

 

extern int WavePeriod = 10;

extern int AvgPeriod = 21;

extern bool SoundAlert = True;

extern bool EmailAlert = FALSE;

double g_ibuf_92[];

double g_ibuf_96[];

double g_ibuf_100[];

double g_ibuf_104[];

double g_ibuf_108[];

double g_ibuf_112[];

double g_ibuf_116[];

double g_ibuf_120[];

int gi_124 = -50;

int gi_128 = 53;

int gi_132;

int gi_136 = 7006344;

 

int init() {

IndicatorShortName("TrendWave v1.23");

SetIndexBuffer(0, g_ibuf_100);

SetIndexLabel(0, "ESA");

SetIndexStyle(0, DRAW_NONE);

SetIndexDrawBegin(0, 0);

SetIndexBuffer(1, g_ibuf_112);

SetIndexLabel(1, "DD Values");

SetIndexStyle(1, DRAW_NONE);

SetIndexDrawBegin(1, 0);

SetIndexBuffer(2, g_ibuf_104);

SetIndexLabel(2, "DD");

SetIndexStyle(2, DRAW_NONE);

SetIndexDrawBegin(2, 0);

SetIndexBuffer(3, g_ibuf_108);

SetIndexLabel(3, "CI");

SetIndexStyle(3, DRAW_NONE);

SetIndexDrawBegin(3, 0);

SetIndexBuffer(4, g_ibuf_92);

SetIndexLabel(4, "Bull 23");

SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 1, Lime);

SetIndexDrawBegin(4, 0);

SetIndexBuffer(5, g_ibuf_96);

SetIndexLabel(5, "Bear 23");

SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 1, Red);

SetIndexDrawBegin(5, 0);

SetIndexBuffer(6, g_ibuf_116);

SetIndexLabel(6, "Buy Dot 23");

SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, 2, Aqua);

SetIndexArrow(6, 108);

SetIndexDrawBegin(6, 0);

SetIndexBuffer(7, g_ibuf_120);

SetIndexLabel(7, "Sell Dot 23");

SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, 2, Yellow);

SetIndexArrow(7, 108);

SetIndexDrawBegin(7, 0);

return (0);

}

 

int start() {

double l_ima_on_arr_0;

/* if (gi_136 != AccountNumber()) {

Comment("Trade on account :" + AccountNumber() + " is FORBIDDEN!");

return (0);

}

Comment("");

*/

int li_12 = IndicatorCounted();

if (li_12 < 0) return (-1);

if (li_12 > 0) li_12--;

int l_bars_8 = Bars;

for (int l_bars_16 = l_bars_8; l_bars_16 > 0; l_bars_16--) {

g_ibuf_100[l_bars_16] = iMA(NULL, 0, WavePeriod, 0, MODE_EMA, PRICE_TYPICAL, l_bars_16);

ArraySetAsSeries(g_ibuf_100, TRUE);

}

for (l_bars_16 = l_bars_8; l_bars_16 > 0; l_bars_16--) {

g_ibuf_112[l_bars_16] = MathAbs((iHigh(NULL, 0, l_bars_16) + iClose(NULL, 0, l_bars_16) + iLow(NULL, 0, l_bars_16)) / 3.0 - g_ibuf_100[l_bars_16]);

ArraySetAsSeries(g_ibuf_112, TRUE);

}

for (l_bars_16 = l_bars_8; l_bars_16 > 0; l_bars_16--) {

l_ima_on_arr_0 = iMAOnArray(g_ibuf_112, 0, WavePeriod, 0, MODE_EMA, l_bars_16);

g_ibuf_104[l_bars_16] = l_ima_on_arr_0;

ArraySetAsSeries(g_ibuf_104, TRUE);

}

for (l_bars_16 = l_bars_8; l_bars_16 > 0; l_bars_16--) {

if (g_ibuf_104[l_bars_16] > 0.0) g_ibuf_108[l_bars_16] = ((iHigh(NULL, 0, l_bars_16) + iClose(NULL, 0, l_bars_16) + iLow(NULL, 0, l_bars_16)) / 3.0 - g_ibuf_100[l_bars_16]) / (0.015 * g_ibuf_104[l_bars_16]);

else g_ibuf_108[l_bars_16] = 0;

ArraySetAsSeries(g_ibuf_108, TRUE);

}

for (l_bars_16 = l_bars_8; l_bars_16 > 0; l_bars_16--) {

l_ima_on_arr_0 = iMAOnArray(g_ibuf_108, 0, AvgPeriod, 0, MODE_EMA, l_bars_16);

g_ibuf_92[l_bars_16] = l_ima_on_arr_0;

ArraySetAsSeries(g_ibuf_92, TRUE);

}

for (l_bars_16 = l_bars_8; l_bars_16 > 0; l_bars_16--) {

l_ima_on_arr_0 = iMAOnArray(g_ibuf_92, 0, 4, 0, MODE_SMA, l_bars_16);

g_ibuf_96[l_bars_16] = l_ima_on_arr_0;

ArraySetAsSeries(g_ibuf_96, TRUE);

}

for (l_bars_16 = l_bars_8; l_bars_16 > 0; l_bars_16--) {

if (g_ibuf_92[l_bars_16] >= g_ibuf_96[l_bars_16] && g_ibuf_92[l_bars_16 + 1] <= g_ibuf_96[l_bars_16 + 1] && g_ibuf_92[l_bars_16] < gi_124) {

g_ibuf_116[l_bars_16] = g_ibuf_92[l_bars_16];

if (l_bars_16 == 1) SendAlert("buy");

} else g_ibuf_116[l_bars_16] = -1000;

if (g_ibuf_92[l_bars_16] <= g_ibuf_96[l_bars_16] && g_ibuf_92[l_bars_16 + 1] >= g_ibuf_96[l_bars_16 + 1] && g_ibuf_92[l_bars_16] > gi_128) {

g_ibuf_120[l_bars_16] = g_ibuf_96[l_bars_16];

if (l_bars_16 != 1) continue;

SendAlert("sell");

continue;

}

g_ibuf_120[l_bars_16] = -1000;

}

return (0);

}

 

void SendAlert(string as_0) {

if (Time[1] != gi_132) {

if (SoundAlert) {

if (as_0 == "buy") Alert(Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " buy");

if (as_0 == "sell") Alert(Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " sell");

}

if (EmailAlert) {

if (as_0 == "buy") SendMail("TrendWave Alert", Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " buy");

if (as_0 == "sell") SendMail("TrendWave Alert", Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " sell");

}

gi_132 = Time[1];

}

}

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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