INDIKATOR
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
int gi_76 = 0;
int gi_80 = 30;
double gd_84 = 9.0;
extern bool SIGNAL_ON = TRUE;
extern double Profit = 15.0;
extern double StopLoss = 45.0;
int gi_112;
int gi_116;
int gi_120;
int gi_124;
double gd_128;
double g_high_136;
double g_low_144;
double gda_152[];
double gda_156[];
int g_time_160 = 0;
int init() {
if (Bars < gi_76 + gd_84 || gi_76 == 0) gi_116 = Bars - gd_84;
else gi_116 = gi_76;
IndicatorBuffers(2);
IndicatorShortName("SIGNAL");
SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 1);
SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 1);
SetIndexArrow(0, 159);
SetIndexArrow(1, 159);
return (0);
}
int deinit() {
return (0);
}
int start() {
int l_ind_counted_0 = IndicatorCounted();
if (l_ind_counted_0 < 0) return (-1);
if (gi_116 > Bars - l_ind_counted_0) gi_116 = Bars - l_ind_counted_0;
for (gi_112 = 1; gi_112 < gi_116; gi_112++) {
gd_128 = 0;
for (gi_120 = gi_112; gi_120 < gi_112 + 10; gi_120++) gd_128 += (gi_112 + 10 - gi_120) * (High[gi_120] - Low[gi_120]);
gd_128 /= 55.0;
g_high_136 = High[iHighest(NULL, 0, MODE_HIGH, gd_84, gi_112)];
g_low_144 = Low[iLowest(NULL, 0, MODE_LOW, gd_84, gi_112)];
if (Close[gi_112] < g_low_144 + (g_high_136 - g_low_144) * gi_80 / 100.0 && gi_124 != -1) {
gda_156[gi_112] = Low[gi_112] - gd_128 / 2.0;
gi_124 = -1;
DoAlert(gi_124);
}
if (Close[gi_112] > g_high_136 - (g_high_136 - g_low_144) * gi_80 / 100.0 && gi_124 != 1) {
gda_152[gi_112] = High[gi_112] + gd_128 / 2.0;
gi_124 = 1;
DoAlert(gi_124);
}
}
return (0);
}
void DoAlert(int ai_0) {
if (!NewBar() || !SIGNAL_ON) return;
string ls_4 = " BUY Now @ : " + Ask + ", TP @ : " + ((Bid + Profit * Point)) + "," + " SL @ : " + ((Bid - StopLoss * Point));
if (ai_0 == 1) ls_4 = " SELL Now @ : " + Bid + ", TP @ : " + ((Ask - Profit * Point)) + "," + " SL @ : " + ((Ask + StopLoss * Point));
Alert(Symbol(), " ", Period(), " alert!! ", ls_4);
}
bool NewBar() {
if (g_time_160 != Time[0]) {
g_time_160 = Time[0];
return (TRUE);
}
return (FALSE);
}
Langganan:
Postingan (Atom)