Best Indicator Forever

Best Indicator Forever

更新日期:2022-02-21分类标签: 语言:中文平台:没限制

606 人已下载 手机查看

Best Indicator Forever

 

/* Changes:
Added control over arrow size
Added control over arrow colours
Added control of font type
Added control of font size
Added control of font colour
Added PUSH notifications for Bull or Bearish signal
Changed points to pips in the calculations and display
*/
#property copyright “”
#property link “”

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 Red
#property indicator_color3 Red

extern string St_Ex = “——- Indicator Settings”;
extern bool Verbose = FALSE;
extern int MinRange = 5;
extern int MaxRange = 30;
extern int HighLowFilter = 10;
extern int MaxHistoryBars = 500;
extern string AN_Ex = “——- Trade Analysis”;
extern string AN_Ex2 = “>> Analyzes the performance of signals”;
extern bool AnalysisEnabled = TRUE;
extern bool DisplayProfits = TRUE;
extern color AnalysisColor = Magenta;
extern color AnalysisLabel = Aqua;
extern int ArrowSize = 2;
extern color ArrowUpCol = LightSkyBlue;
extern color ArrowDnCol = Tomato;
extern string UrFont = “Tahoma”;
extern int UrFontSize = 7;
extern color UrFontCol = Lime;
extern string Se_Ex3 = “——- Drawing Boxes”;
extern color BullRectangle = LightSkyBlue;
extern color BearRectangle = Tomato;
extern string Alerts_ex = “——- Alerts”;
extern string AlertCaption = “DayTrading Alert”;
extern bool DisplayAlerts = TRUE;
extern bool EmailAlerts = FALSE;
extern bool SoundAlerts = TRUE;
extern bool PushAlerts = TRUE;
string SoundFile = “alert.wav”;

double G_ibuf_188[];
double G_ibuf_192[];
double G_ibuf_196[];
double G_ibuf_200[];
double G_ibuf_204[];
bool Gi_208 = FALSE;
double Gd_212;
double G_close_220 = 0.0;
double G_close_228 = 0.0;
int G_datetime_236 = 0;
int G_datetime_240 = 0;
datetime G_time_244;
bool Gi_248 = TRUE;
double G_high_252;
double G_low_260 = 0.0;
datetime G_time_268;
datetime G_time_272 = 0;
int G_count_276;
int G_count_280;
int Gi_284;
int G_count_288 = 0;
double Gd_292 = 0.0;
int Gi_300 = 0;

int init() {
IndicatorBuffers(5);
G_high_252 = 0;
G_low_260 = 0;
G_time_268 = 0;
G_time_272 = 0;
G_count_276 = 0;
G_count_280 = 0;
Gi_284 = 0;
G_count_288 = 0;
G_close_220 = 0;
G_close_228 = 0;
G_datetime_236 = 0;
G_datetime_240 = 0;
Gd_292 = 0;
Gi_300 = 0;
SetIndexStyle(0, DRAW_ARROW,EMPTY,ArrowSize,ArrowUpCol);
SetIndexArrow(0, 233);
SetIndexStyle(1, DRAW_ARROW,EMPTY,ArrowSize,ArrowDnCol);
SetIndexArrow(1, 234);
SetIndexStyle(2, DRAW_ARROW);
SetIndexArrow(2, SYMBOL_STOPSIGN);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
SetIndexBuffer(0, G_ibuf_188);
SetIndexBuffer(1, G_ibuf_192);
SetIndexBuffer(2, G_ibuf_196);
SetIndexBuffer(3, G_ibuf_204);
SetIndexBuffer(4, G_ibuf_200);
IndicatorShortName(“Day Trading H1”);
Comment(“”);
f0_12();
return (0);
}

int f0_12() {
string name_0;
int objs_total_8 = ObjectsTotal();
for (int Li_12 = objs_total_8 – 1; Li_12 >= 0; Li_12–) {
name_0 = ObjectName(Li_12);
if (StringFind(name_0, “RMDT”) != -1) ObjectDelete(name_0);
}
return (0);
}

int deinit() {
f0_12();
return (0);
}

int start() {
double Ld_4;
double Ld_12;
double iatr_20;
double Ld_28;
double Ld_36;
double Ld_44;
double Ld_52;
double Ld_60;
double Ld_68;
double close_76;
double Ld_84;
if (!Gi_208) {
if ((!IsConnected()) && 1) return (1);
Gi_208 = TRUE;
}
if (!Gi_208) return (1);
int Li_92 = 1;
int ind_counted_96 = IndicatorCounted();
if (ind_counted_96 < 0) return (-1);
int Li_100 = Bars – 1 – ind_counted_96;
for (int Li_104 = Li_100; Li_104 >= Li_92; Li_104–) {
if (Li_104 <= MaxHistoryBars) {
Ld_4 = f0_1(Li_104, HighLowFilter);
Ld_12 = f0_8(Li_104, HighLowFilter);
iatr_20 = iATR(Symbol(), 0, 50, Li_104);
Gd_212 = iatr_20 / 100.0;
Ld_28 = 8.0 * Gd_212;
Ld_36 = f0_14(Li_104);
Ld_44 = f0_2(Li_104);
Ld_52 = f0_9(Li_104);
G_ibuf_204[Li_104] = G_ibuf_204[Li_104 + 1];
G_ibuf_200[Li_104] = EMPTY_VALUE;
close_76 = Close[Li_104];
Ld_84 = 1;
for (int Li_108 = MinRange; Li_108 <= MaxRange; Li_108++) {
Ld_60 = f0_1(Li_104, Li_108);
Ld_68 = f0_8(Li_104, Li_108);
if (f0_16(Li_104, Li_108) && Verbose && G_ibuf_204[Li_104] == 0.0 && (Ld_60 >= Ld_4 || High[Li_104] >= Ld_4 || 0)) {
if (!(f0_0(Li_104, Li_108 + 1, BullRectangle, 0, 0))) break;
G_ibuf_200[Li_104] = 0;
G_ibuf_204[Li_104] = 0;
break;
}
if (f0_7(Li_104, Li_108) && Verbose && G_ibuf_204[Li_104] == 1.0 && (Ld_68 <= Ld_12 || Low[Li_104] <= Ld_4 || 0)) {
if (!(f0_0(Li_104, Li_108 + 1, BearRectangle, 0, 0))) break;
G_ibuf_200[Li_104] = 1;
G_ibuf_204[Li_104] = 1;
break;
}
if (f0_16(Li_104, Li_108) && 1 && ((G_ibuf_204[Li_104] != 0.0) || (G_ibuf_204[Li_104] == 0.0 && G_close_220 > close_76)) && (Ld_68 <= Ld_12 || Low[Li_104] <= Ld_4 || 0)) {
if (G_ibuf_204[Li_104] == 0.0 && G_close_220 > close_76) Ld_84 = 0;
else Ld_84 = 1;
if (!(f0_0(Li_104, Li_108 + 1, BullRectangle, 1, Ld_84))) break;
f0_5();
G_close_220 = close_76;
G_ibuf_200[Li_104] = 0;
G_ibuf_204[Li_104] = 0;
break;
}
if (f0_7(Li_104, Li_108) && 1 && ((G_ibuf_204[Li_104] != 1.0) || (G_ibuf_204[Li_104] == 1.0 && G_close_228 < close_76)) && (Ld_60 >= Ld_4 || High[Li_104] >= Ld_4 || 0)) {
if (G_ibuf_204[Li_104] == 1.0 && G_close_228 < close_76) Ld_84 = 0;
else Ld_84 = 1;
if (!(f0_0(Li_104, Li_108 + 1, BearRectangle, 1, Ld_84))) break;
f0_5();
G_close_228 = close_76;
G_ibuf_200[Li_104] = 1;
G_ibuf_204[Li_104] = 1;
break;
}
if (f0_17(Li_104, Li_108) && 1 && ((G_ibuf_204[Li_104] != 0.0) || (G_ibuf_204[Li_104] == 0.0 && G_close_220 > close_76)) && (Ld_68 <= Ld_12 || Low[Li_104] <= Ld_4 || 0)) {
if (G_ibuf_204[Li_104] == 0.0 && G_close_220 > close_76) Ld_84 = 0;
else Ld_84 = 1;
if (!(f0_0(Li_104, Li_108 + 1, BullRectangle, 1, Ld_84))) break;
f0_5();
G_close_220 = close_76;
G_ibuf_200[Li_104] = 0;
G_ibuf_204[Li_104] = 0;
break;
}
if (f0_13(Li_104, Li_108) && 1 && ((G_ibuf_204[Li_104] != 1.0) || (G_ibuf_204[Li_104] == 1.0 && G_close_228 < close_76)) && (Ld_60 >= Ld_4 || High[Li_104] >= Ld_4 || 0)) {
if (G_ibuf_204[Li_104] == 1.0 && G_close_228 < close_76) Ld_84 = 0;
else Ld_84 = 1;
if (!(f0_0(Li_104, Li_108 + 1, BearRectangle, 1, Ld_84))) break;
f0_5();
G_close_228 = close_76;
G_ibuf_200[Li_104] = 1;
G_ibuf_204[Li_104] = 1;
break;
}
}
if (AnalysisEnabled) f0_3(Li_104);
}
}
if (G_time_244 != Time[0]) {
if (G_ibuf_200[1] == 0.0 && Gi_248 == FALSE) {
if (DisplayAlerts == TRUE) Alert(“RM Day Trading” + ” (” + AlertCaption + “) [” + Symbol() + “] Bullish Breakout”);
if (EmailAlerts == TRUE) SendMail(“RM Day Trading” + ” (” + AlertCaption + “) [” + Symbol() + “]”, “[” + Symbol() + “] Bullish Breakout”);
if (SoundAlerts == TRUE) PlaySound(SoundFile);
if (PushAlerts == TRUE) SendNotification(“Bullish Breakout ” + _Symbol);
} else {
if (G_ibuf_200[1] == 1.0 && Gi_248 == FALSE) {
if (DisplayAlerts == TRUE) Alert(“RM Day Trading” + ” (” + AlertCaption + “) [” + Symbol() + “] Bearish Breakout”);
if (EmailAlerts == TRUE) SendMail(“RM Day Trading” + ” (” + AlertCaption + “) [” + Symbol() + “]”, “[” + Symbol() + “] Bearish Breakout”);
if (SoundAlerts == TRUE) PlaySound(SoundFile);
if (PushAlerts == TRUE) SendNotification(“Bearish Breakout ” + _Symbol);
}
}
G_time_244 = Time[0];
Gi_248 = FALSE;
}
return (0);
}

void f0_5() {
G_high_252 = 0;
G_low_260 = 0;
f0_4();
}

void f0_4() {
int Li_0;
int Li_4;
int Li_8;
int Li_12;
int Li_16;
double Ld_20 = G_count_276 + G_count_280;
if (Ld_20 != 0.0) {
Li_0 = MathFloor(Ld_20);
Li_4 = MathCeil(100.0 * (G_count_276 / Ld_20));
Li_8 = MathFloor(100.0 * (G_count_280 / Ld_20));
Li_12 = MathCeil(Gi_284 / G_count_288);
Li_16 = MarketInfo(Symbol(), MODE_SPREAD);
Comment(” \n” + “Winning Trades: ” + Li_4 + “% (” + G_count_276 + ” of ” + Li_0 + “) \n” + “Losing Trades: ” + Li_8 + “% (” +
G_count_280 + ” of ” + Li_0 + “) \n” + “Average Signal: ” + Li_12 + ” pips \n” + “Spread: ” + Li_16/10 + ” pips”);
}
}

void f0_3(int Ai_0) {
if (High[Ai_0] > G_high_252 || G_high_252 == 0.0) {
G_high_252 = High[Ai_0];
G_time_268 = Time[Ai_0];
}
if (Low[Ai_0] < G_low_260 || G_low_260 == 0.0) {
G_low_260 = Low[Ai_0];
G_time_272 = Time[Ai_0];
}
}

int f0_13(int Ai_0, int Ai_4) {
double Ld_8 = MathAbs(High[Ai_0] – Low[Ai_0]);
if (f0_11(Ai_0) && Close[Ai_0] < f0_8(Ai_0, Ai_4) && f0_6(Ai_0 + Ai_4 + 1)) return (1);
return (0);
}

int f0_17(int Ai_0, int Ai_4) {
double Ld_8 = MathAbs(High[Ai_0] – Low[Ai_0]);
if (f0_6(Ai_0) && Close[Ai_0] > f0_1(Ai_0, Ai_4) && f0_11(Ai_0 + Ai_4 + 1)) return (1);
return (0);
}

int f0_16(int Ai_0, int Ai_4) {
double Ld_8 = MathAbs(High[Ai_0] – Low[Ai_0]);
if (f0_6(Ai_0) && Close[Ai_0] > f0_1(Ai_0, Ai_4) && Open[Ai_0] < Close[Ai_0 + Ai_4 + 1] && Close[Ai_0] > High[Ai_0 + Ai_4 + 1]) return (1);
return (0);
}

int f0_7(int Ai_0, int Ai_4) {
double Ld_8 = MathAbs(High[Ai_0] – Low[Ai_0]);
if (f0_11(Ai_0) && Close[Ai_0] < f0_8(Ai_0, Ai_4) && Open[Ai_0] > Close[Ai_0 + Ai_4 + 1] && Close[Ai_0] < Low[Ai_0 + Ai_4 + 1]) return (1);
return (0);
}

double f0_9(int Ai_0) {
if (Close[Ai_0] > Open[Ai_0]) return (MathAbs(High[Ai_0] – Close[Ai_0]));
return (MathAbs(High[Ai_0] – Open[Ai_0]));
}

double f0_2(int Ai_0) {
if (Close[Ai_0] < Open[Ai_0]) return (MathAbs(Close[Ai_0] – Low[Ai_0]));
return (MathAbs(Open[Ai_0] – Low[Ai_0]));
}

void f0_10(string A_text_0, int Ai_8, int Ai_12, color A_color_16, int Ai_20) {
int time_24;
datetime time_28;
double price_32;
string name_40;
if (DisplayProfits) {
time_24 = Time[Ai_8];
time_28 = Time[Ai_8 + 1];
if (Ai_12 == 0) price_32 = Low[Ai_8] – Gd_212 * Ai_20;
else price_32 = High[Ai_8] + Gd_212 * Ai_20;
name_40 = “RMDT” + “-” + A_text_0 + “-” + time_28;
ObjectCreate(name_40, OBJ_TEXT, 0, time_24, price_32);
ObjectSetText(name_40, A_text_0, UrFontSize, UrFont, UrFontCol);
ObjectSet(name_40, OBJPROP_BACK, TRUE);
}
}

void f0_15(string A_name_0, int A_datetime_8, int A_datetime_12, double A_price_16, double A_price_24, color A_color_32, int A_style_36, int A_width_40, int A_bool_44) {
if (ObjectFind(A_name_0) != -1) ObjectDelete(A_name_0);
ObjectCreate(A_name_0, OBJ_TREND, 0, A_datetime_8, A_price_16, A_datetime_12, A_price_24);
ObjectSet(A_name_0, OBJPROP_RAY, A_bool_44);
ObjectSet(A_name_0, OBJPROP_STYLE, A_style_36);
ObjectSet(A_name_0, OBJPROP_WIDTH, A_width_40);
ObjectSet(A_name_0, OBJPROP_COLOR, A_color_32);
ObjectSet(A_name_0, OBJPROP_BACK, TRUE);
}

bool f0_0(int Ai_0, int Ai_4, color A_color_8, bool Ai_12 = TRUE, bool Ai_16 = TRUE) {
string Ls_20;
int Li_28;
int shift_32;
int shift_36;
int shift_40;
int time_44 = Time[Ai_0];
int time_48 = Time[Ai_0 + Ai_4 – 1];
string name_52 = “RMDT” + “Rect-” + Ai_4 + time_48;
if ((A_color_8 == BullRectangle && time_48 <= G_datetime_240) || time_48 > time_44) return (FALSE);
if ((A_color_8 == BearRectangle && time_48 <= G_datetime_236) || time_48 > time_44) return (FALSE);
if (AnalysisEnabled && Ai_16 && Gi_300 > 0 && Gd_292 > 0.0) {
Ls_20 = name_52 + “-res”;
Li_28 = 0;
shift_32 = iBarShift(Symbol(), 0, Gi_300, TRUE);
shift_36 = iBarShift(Symbol(), 0, G_time_268, TRUE);
shift_40 = iBarShift(Symbol(), 0, G_time_272, TRUE);
if (G_ibuf_204[Ai_0] == 0.0) {
if (G_high_252 > High[shift_32]) {
Li_28 = MathAbs(G_high_252 – Gd_292) / Point;
f0_15(Ls_20, Gi_300, G_time_268, Gd_292, G_high_252, AnalysisColor, STYLE_DOT, 1, FALSE);
f0_10(“+” + Li_28/10, shift_36, 1, AnalysisLabel, 25);
Gi_284 += Li_28/10;
G_count_276++;
} else {
G_ibuf_196[shift_32] = High[shift_32];
G_count_280++;
}
} else {
if (G_low_260 < Low[shift_32]) {
Li_28 = MathAbs(Gd_292 – G_low_260) / Point;
f0_15(Ls_20, Gi_300, G_time_272, Gd_292, G_low_260, AnalysisColor, STYLE_DOT, 1, FALSE);
f0_10(“+” + Li_28/10, shift_40, 0, AnalysisLabel, 5);
Gi_284 += Li_28/10;
G_count_276++;
} else {
G_ibuf_196[shift_32] = Low[shift_32];
G_count_280++;
}
}
}
if (AnalysisEnabled && Ai_12) {
Gi_300 = time_44;
Gd_292 = Close[Ai_0];
}
int Li_60 = Ai_0 + Ai_4;
double ihigh_64 = iHigh(Symbol(), Period(), iHighest(Symbol(), Period(), MODE_HIGH, Ai_4 – 1, Ai_0 + 1));
double ilow_72 = iLow(Symbol(), Period(), iLowest(Symbol(), Period(), MODE_LOW, Ai_4 – 1, Ai_0 + 1));
ObjectCreate(name_52, OBJ_RECTANGLE, 0, time_44, ilow_72, time_48, ihigh_64);
ObjectSet(name_52, OBJPROP_COLOR, A_color_8);
ObjectSet(name_52, OBJPROP_BACK, FALSE);
if (A_color_8 == BullRectangle) {
G_ibuf_188[Ai_0] = ilow_72;
G_datetime_240 = time_48;
} else {
G_ibuf_192[Ai_0] = ihigh_64;
G_datetime_236 = time_48;
}
G_count_288++;
return (TRUE);
}

double f0_14(int Ai_0) {
if (Close[Ai_0] < Open[Ai_0]) return (MathAbs(Close[Ai_0] – Open[Ai_0]));
return (MathAbs(Open[Ai_0] – Close[Ai_0]));
}

int f0_6(int Ai_0) {
if (Close[Ai_0] > Open[Ai_0]) return (1);
return (0);
}

int f0_11(int Ai_0) {
if (Close[Ai_0] < Open[Ai_0]) return (1);
return (0);
}

double f0_1(int Ai_0, int Ai_4) {
return (iHigh(Symbol(), Period(), iHighest(Symbol(), Period(), MODE_HIGH, Ai_4, Ai_0 + 1)));
}

double f0_8(int Ai_0, int Ai_4) {
return (iLow(Symbol(), Period(), iLowest(Symbol(), Period(), MODE_LOW, Ai_4, Ai_0 + 1)));
}

如果你对文件有了解,请帮助投票!

If you are familiar with the file, please help vote!

平均评分 5 / 5. 投票数: 1

到目前为止还没有投票!成为第一位投票人。

相关资源

2 条评论

  • roger 游客

    Ola por favor vc poderia atualizar o link de dowload, ele está quebrado

    巴西
    回复
    • admin

      Fixed

      中国
      回复