Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
TrendEnvelopes_v5
/*
Generated by EX4-TO-MQ4 decompiler ONE FILE V4.0.217.1
EX4 ID : 758C6ED8A1FFEEE46780B6453C1F79CA
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2007, TrendLaboratory Ltd."
#property link "http://finance.groups.yahoo.com/group/TrendLaboratory"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Yellow
#property indicator_color2 Yellow
#property indicator_color3 Yellow
#property indicator_color4 Yellow
extern int MA_Period = 3;
extern int MA_Method = 1;
extern int UseSignal = 0;
extern int AlertMode = 0;
extern int WarningMode = 0;
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 = 0;
bool gi_128 = FALSE;
bool gi_132 = FALSE;
int init() {
string ls_unused_4;
IndicatorBuffers(7);
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
SetIndexStyle(2, DRAW_ARROW);
SetIndexArrow(2, 108);
SetIndexStyle(3, DRAW_ARROW);
SetIndexArrow(3, 108);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
if (MA_Period < 2) MA_Period = 10;
int li_0 = MA_Period - 1;
IndicatorShortName("TrendEnvelopes(" + MA_Period + ")");
SetIndexLabel(0, "UpTrendEnv");
SetIndexLabel(1, "DnTrendEnv");
SetIndexLabel(2, "UpSignal");
SetIndexLabel(3, "DnSignal");
SetIndexDrawBegin(0, li_0);
SetIndexDrawBegin(1, li_0);
SetIndexDrawBegin(2, li_0);
SetIndexDrawBegin(3, li_0);
SetIndexBuffer(0, g_ibuf_96);
SetIndexBuffer(1, g_ibuf_100);
SetIndexBuffer(2, g_ibuf_104);
SetIndexBuffer(3, g_ibuf_108);
SetIndexBuffer(4, g_ibuf_112);
SetIndexBuffer(5, g_ibuf_116);
SetIndexBuffer(6, g_ibuf_120);
return (0);
}
int start() {
string ls_8;
if (Bars <= MA_Period) return (0);
gi_124 = IndicatorCounted();
if (gi_124 < 0) return (-1);
if (gi_124 > 0) gi_124--;
int li_0 = Bars - gi_124;
for (int li_4 = li_0; li_4 >= 0; li_4--) {
g_ibuf_112[li_4] = iMA(NULL, 0, MA_Period, 0, MA_Method, PRICE_HIGH, li_4);
g_ibuf_116[li_4] = iMA(NULL, 0, MA_Period, 0, MA_Method, PRICE_LOW, li_4);
g_ibuf_120[li_4] = g_ibuf_120[li_4 + 1];
if (Close[li_4] > g_ibuf_112[li_4 + 1]) g_ibuf_120[li_4] = 1;
if (Close[li_4] < g_ibuf_116[li_4 + 1]) g_ibuf_120[li_4] = -1;
if (g_ibuf_120[li_4] > 0.0) {
if (g_ibuf_116[li_4] < g_ibuf_116[li_4 + 1]) g_ibuf_116[li_4] = g_ibuf_116[li_4 + 1];
g_ibuf_96[li_4] = g_ibuf_116[li_4];
if (UseSignal > 0) {
if (g_ibuf_120[li_4 + 1] < 0.0) {
g_ibuf_104[li_4] = g_ibuf_116[li_4];
if (WarningMode > 0 && li_4 == 0) PlaySound("alert2.wav");
} else g_ibuf_104[li_4] = EMPTY_VALUE;
}
g_ibuf_100[li_4] = EMPTY_VALUE;
g_ibuf_108[li_4] = EMPTY_VALUE;
} else {
if (g_ibuf_112[li_4] > g_ibuf_112[li_4 + 1]) g_ibuf_112[li_4] = g_ibuf_112[li_4 + 1];
g_ibuf_100[li_4] = g_ibuf_112[li_4];
if (UseSignal > 0) {
if (g_ibuf_120[li_4 + 1] > 0.0) {
g_ibuf_108[li_4] = g_ibuf_112[li_4];
if (WarningMode > 0 && li_4 == 0) PlaySound("alert2.wav");
} else g_ibuf_108[li_4] = EMPTY_VALUE;
}
g_ibuf_96[li_4] = EMPTY_VALUE;
g_ibuf_104[li_4] = EMPTY_VALUE;
}
}
if (g_ibuf_120[2] < 0.0 && g_ibuf_120[1] > 0.0 && Volume[0] > 1.0 && !gi_128) {
ls_8 = " " + Symbol() + " M" + Period() + ": Signal for BUY";
if (AlertMode > 0) Alert(ls_8);
gi_128 = TRUE;
gi_132 = FALSE;
}
if (g_ibuf_120[2] > 0.0 && g_ibuf_120[1] < 0.0 && Volume[0] > 1.0 && !gi_132) {
ls_8 = " " + Symbol() + " M" + Period() + ": Signal for SELL";
if (AlertMode > 0) Alert(ls_8);
gi_132 = TRUE;
gi_128 = FALSE;
}
return (0);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---