Author: xbox forex
xb4c
Price Data Components
Series array that contains open time of each barSeries array that contains open prices of each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains close prices for each bar
1 Views
0 Downloads
0 Favorites
xb4c

#property copyright "xbox forex"
#property link      "http://community.strangled.net"

#property indicator_chart_window

extern int pipschange = 20;
extern int SL = 30;
extern bool show_daily_pivot = FALSE;
extern bool show_hilo_yesterday = TRUE;
extern bool show_XBForexcpivot = TRUE;
string gs_96 = "Pivot=";
string gs_104 = "S1=";
string gs_112 = "S2=";
string gs_120 = "S3=";
string gs_128 = "R1=";
string gs_136 = "R2=";
string gs_144 = "R3=";
string gs_152 = "Open=";
string gs_160 = "XBForex Resistance=";
string gs_168 = "XBForex Buy Breakout=";
string gs_176 = "XBForex Reversal (Sell)=";
string gs_184 = "XBForex Support=";
string gs_192 = "XBForex Sell Breakout=";
string gs_200 = "XBForex Reversal (Buy)=";
string g_str_concat_208;
double gd_216;
double gd_224;
double gd_232;
double gd_240;
double gd_248;
double gd_256;
double gd_264;
int ti_0;
double gd_280;
double gd_288;
double gd_296;
double gd_304;
double gd_312;
double gd_320;
double gd_328;
double gd_336;
double g_iopen_344;
double gd_352;
double gd_360;
double gd_368;
double gd_376;
double gd_384;
double gd_392;
double gd_400;
int g_str2time_408;
int g_str2time_412;
double gd_416 = 0.0;
double gd_424 = 0.0;
double gd_432 = 0.0;
double gd_440 = 0.0;
double gd_448 = 0.0;
double gd_456 = 0.0;
string gs_464 = "xbox forex system v4";

int init() {
   XBForexdelete();

   IndicatorShortName(gs_464);
   return (0);
}

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

int start() {
   double ld_8;
   double ld_16;
   double ld_24;
   double lda_68[1][6];
   double ld_72;
   double ld_80;
   double ld_88;
   double l_iopen_100;
   double l_ihigh_108;
   double l_ilow_116;
   double l_iclose_124;
   string ls_132;
   string ls_140;
   string ls_148;
   string l_dbl2str_156;
   string l_dbl2str_164;
   string ls_unused_172;
   string l_dbl2str_180;
   string l_str_concat_188;
   string l_str_concat_196;
   int li_204;
   int l_ind_counted_4 = IndicatorCounted();
   double l_pips_36 = 1;
   bool li_44 = FALSE;
   double ld_48 = MarketInfo(Symbol(), MODE_SPREAD);
   if (Digits == 5 || Digits == 3) {
      l_pips_36 = 10;
      ld_48 /= 10.0;
      li_44 = TRUE;
   }
   double ld_56 = Point * l_pips_36;
   int li_64 = Bars - l_ind_counted_4 - 1;
   creataalltext();
  
   if (l_ind_counted_4 < 0) return (-1);
   for (int li_0 = li_64; li_0 >= 0; li_0--) {
      ArrayCopyRates(lda_68, Symbol(), PERIOD_D1);
      if (DayOfWeek() == 1) {
         if (TimeDayOfWeek(iTime(Symbol(), PERIOD_D1, 1)) == 5) {
            ld_72 = lda_68[1][4];
            ld_80 = lda_68[1][3];
            ld_88 = lda_68[1][2];
         } else {
            for (int li_96 = 5; li_96 >= 0; li_96--) {
               if (TimeDayOfWeek(iTime(Symbol(), PERIOD_D1, li_96)) == 5) {
                  ld_72 = lda_68[li_96][4];
                  ld_80 = lda_68[li_96][3];
                  ld_88 = lda_68[li_96][2];
                  break;
               }
            }
         }
      } else {
         ld_72 = lda_68[1][4];
         ld_80 = lda_68[1][3];
         ld_88 = lda_68[1][2];
      }
      gd_232 = ld_72;
      gd_216 = ld_80;
      gd_224 = ld_88;
      g_iopen_344 = iOpen(Symbol(), PERIOD_D1, 0);
      gd_240 = (gd_216 + gd_224 + gd_232) / 3.0;
      gd_248 = 2.0 * gd_240 - gd_216;
      gd_256 = gd_240 - (gd_216 - gd_224);
      gd_264 = 2.0 * gd_240 - (2.0 * gd_216 - gd_224);
      ti_0 = 2.0 * gd_240 - gd_224;
      gd_280 = gd_240 + (gd_216 - gd_224);
      gd_288 = 2.0 * gd_240 + (gd_216 - 2.0 * gd_224);
      gd_368 = gd_216 / gd_224 * gd_232;
      gd_360 = (gd_216 / gd_224 + 0.83) / 1.83 * gd_232;
      gd_352 = (gd_216 / gd_224 + 2.66) / 3.66 * gd_232;
      gd_392 = gd_232 - (gd_368 - gd_232);
      gd_384 = gd_232 - (gd_360 - gd_232);
      gd_376 = gd_232 - (gd_352 - gd_232);
      gd_296 = gd_240 - (pipschange + 1) * ld_56;
      gd_304 = gd_240 + (pipschange + 1) * ld_56;
      ld_8 = g_iopen_344 + pipschange * ld_56;
      ld_16 = g_iopen_344 - pipschange * ld_56;
      if (g_iopen_344 > gd_240) ld_24 = g_iopen_344 - gd_240;
      else ld_24 = gd_240 - g_iopen_344;
      if (ld_24 >= pipschange / 2 * ld_56) {
         gd_296 = ld_16;
         gd_304 = ld_8;
      }
      gd_416 = 0;
      gd_424 = 0;
      gd_432 = 0;
      gd_440 = 0;
      gd_448 = 0;
      gd_456 = 0;
      gd_416 = (iHigh(Symbol(), PERIOD_D1, 1) - iLow(Symbol(), PERIOD_D1, 1)) / ld_56;
      for (gd_456 = 1; gd_456 <= 5.0; gd_456++) gd_424 += (iHigh(Symbol(), PERIOD_D1, gd_456) - iLow(Symbol(), PERIOD_D1, gd_456)) / ld_56;
      for (gd_456 = 1; gd_456 <= 10.0; gd_456++) gd_432 += (iHigh(Symbol(), PERIOD_D1, gd_456) - iLow(Symbol(), PERIOD_D1, gd_456)) / ld_56;
      for (gd_456 = 1; gd_456 <= 20.0; gd_456++) gd_440 += (iHigh(Symbol(), PERIOD_D1, gd_456) - iLow(Symbol(), PERIOD_D1, gd_456)) / ld_56;
      gd_424 /= 5.0;
      gd_432 /= 10.0;
      gd_440 /= 20.0;
      gd_448 = (gd_416 + gd_424 + gd_432 + gd_440) / 4.0;
      l_iopen_100 = iOpen(Symbol(), PERIOD_D1, 0);
      l_ihigh_108 = iHigh(Symbol(), PERIOD_D1, 0);
      l_ilow_116 = iLow(Symbol(), PERIOD_D1, 0);
      l_iclose_124 = iClose(Symbol(), PERIOD_D1, 0);
      ls_132 = DoubleToStr((l_iclose_124 - l_iopen_100) / ld_56, li_44);
      ls_132 = StringConcatenate(ls_132, "   (", l_iclose_124, ")");
      ls_140 = DoubleToStr((l_ihigh_108 - l_iopen_100) / ld_56, li_44);
      ls_140 = StringConcatenate(ls_140, "   (", l_ihigh_108, ")");
      ls_148 = DoubleToStr((l_ilow_116 - l_iopen_100) / ld_56, li_44);
      ls_148 = StringConcatenate(ls_148, "   (", l_ilow_116, ")");
      l_dbl2str_156 = DoubleToStr(ld_48, li_44);
      l_dbl2str_164 = DoubleToStr(gd_448, Digits - 4);
      ls_unused_172 = (iHigh(Symbol(), PERIOD_D1, 1) - iLow(Symbol(), PERIOD_D1, 1)) / ld_56;
      l_dbl2str_180 = DoubleToStr((l_ihigh_108 - l_ilow_116) / ld_56, li_44);
      gd_312 = gd_296 - pipschange * ld_56;
      gd_328 = gd_296 + SL * ld_56;
      gd_320 = gd_304 + pipschange * ld_56;
      gd_336 = gd_304 - SL * ld_56;
      l_str_concat_188 = StringConcatenate(gd_304, " TP# ", gd_320, " SL# ", gd_336);
      l_str_concat_196 = StringConcatenate(gd_296, " TP# ", gd_312, " SL# ", gd_328);
      Makelabel("XBForexOpenPrice label", StringConcatenate(gs_152, g_iopen_344), Lime, g_iopen_344, 0);
      Makeline("XBForexOpenPrice line", Lime, g_iopen_344);
      if (show_hilo_yesterday == TRUE) {
         Makelabel("XBForexYesterdayLow label", StringConcatenate("Yesterday Low=", gd_224), Yellow, gd_224, 0);
         Makeline("XBForexYesterdayLow line", Yellow, gd_224);
         Makelabel("XBForexYesterdayHigh label", StringConcatenate("Yesterday High=", gd_216), Yellow, gd_216, 0);
         Makeline("XBForexYesterdayHigh line", Yellow, gd_216);
      }
      if (show_daily_pivot == TRUE) {
         Makelabel("XBForexDailyPivot label", StringConcatenate(gs_96, gd_240), White, gd_240, 0);
         Makeline("XBForexDailyPivot line", White, gd_240);
         Makelabel("XBForexDailyS1 label", StringConcatenate(gs_104, gd_248), Yellow, gd_248, 0);
         Makeline("XBForexDailyS1 line", Red, gd_248);
         Makelabel("XBForexDailyS2 label", StringConcatenate(gs_112, gd_256), Yellow, gd_256, 0);
         Makeline("XBForexDailyS2 line", Red, gd_256);
         Makelabel("XBForexDailyS3 label", StringConcatenate(gs_120, gd_264), Yellow, gd_264, 0);
         Makeline("XBForexDailyS3 line", Red, gd_264);
         Makelabel("XBForexDailyR1 label", StringConcatenate(gs_128, ti_0), Yellow, ti_0, 5);
         Makeline("XBForexDailyR1 line", Blue, ti_0);
         Makelabel("XBForexDailyR2 label", StringConcatenate(gs_136, gd_280), Yellow, gd_280, 5);
         Makeline("XBForexDailyR2 line", Blue, gd_280);
         Makelabel("XBForexDailyR3 label", StringConcatenate(gs_144, gd_288), Yellow, gd_288, 5);
         Makeline("XBForexDailyR3 line", Blue, gd_288);
      }
      if (show_XBForexcpivot == TRUE) {
         Makeline("XBForexcH5 line", Blue, gd_368);
         Makelabel("XBForexcH5 label", StringConcatenate(gs_160, gd_368), Yellow, gd_368, 5);
         Makeline("XBForexcH4 line", Blue, gd_360);
         Makelabel("XBForexcH4 label", StringConcatenate(gs_168, gd_360), Yellow, gd_360, 5);
         Makeline("XBForexcH3 line", Blue, gd_352);
         Makelabel("XBForexcH3 label", StringConcatenate(gs_176, gd_352), Yellow, gd_352, 5);
         Makeline("XBForexcL5 line", Red, gd_392);
         Makelabel("XBForexcL5 label", StringConcatenate(gs_184, gd_392), Yellow, gd_392, 0);
         Makeline("XBForexcL4 line", Red, gd_384);
         Makelabel("XBForexcL4 label", StringConcatenate(gs_192, gd_384), Yellow, gd_384, 0);
         Makeline("XBForexcL3 line", Red, gd_376);
         Makelabel("XBForexcL3 label", StringConcatenate(gs_200, gd_376), Yellow, gd_376, 0);
      }
      g_str_concat_208 = "\n";
      g_str_concat_208 = StringConcatenate(g_str_concat_208, " XB Forex V4 2008.06, Indonesia\n");
      g_str_concat_208 = StringConcatenate(g_str_concat_208, " xbox.forex@gmail.com  -  http://community.strangled.net\n\n");
      Comment(g_str_concat_208);
      li_204 = 65535;
      settext("spread_value_label", l_dbl2str_156, 8, li_204, 90, 60);
      if ((l_iclose_124 - l_iopen_100) / ld_56 < 0.0) li_204 = 255;
      if ((l_iclose_124 - l_iopen_100) / ld_56 > 0.0) li_204 = 65280;
      settext("change_value_label", ls_132, 20, li_204, 90, 90);
      li_204 = 65535;
      settext("highest_value_label", ls_140, 8, li_204, 90, 80);
      settext("lowest_value_label", ls_148, 8, li_204, 90, 120);
      settext("hilo_value_label", l_dbl2str_180, 8, li_204, 90, 140);
      settext("dav_value_label", l_dbl2str_164, 8, li_204, 90, 150);
      settext("buy_trap_value_label", l_str_concat_188, 8, li_204, 90, 170);
      settext("sell_trap_value_label", l_str_concat_196, 8, li_204, 90, 190);
   }
   return (0);
}

void XBForexdelete() {
   ObjectDelete("XBForexWeeklyS1 label");
   ObjectDelete("XBForexWeeklyS1 line");
   ObjectDelete("XBForexWeeklyR1 label");
   ObjectDelete("XBForexWeeklyR1 line");
   ObjectDelete("XBForexYesterdayLow label");
   ObjectDelete("XBForexYesterdayLow line");
   ObjectDelete("XBForexYesterdayHigh label");
   ObjectDelete("XBForexYesterdayHigh line");
   ObjectDelete("XBForexOpenPrice line");
   ObjectDelete("XBForexOpenPrice label");
   ObjectDelete("XBForexDailyPivot line");
   ObjectDelete("XBForexDailyPivot label");
   ObjectDelete("XBForexDailyS1 label");
   ObjectDelete("XBForexDailyS1 line");
   ObjectDelete("XBForexDailyS2 label");
   ObjectDelete("XBForexDailyS2 line");
   ObjectDelete("XBForexDailyS3 label");
   ObjectDelete("XBForexDailyS3 line");
   ObjectDelete("XBForexDailyR1 label");
   ObjectDelete("XBForexDailyR1 line");
   ObjectDelete("XBForexDailyR2 label");
   ObjectDelete("XBForexDailyR2 line");
   ObjectDelete("XBForexDailyR3 label");
   ObjectDelete("XBForexDailyR3 line");
   ObjectDelete("XBForexcH5 line");
   ObjectDelete("XBForexcH5 label");
   ObjectDelete("XBForexcH4 line");
   ObjectDelete("XBForexcH4 label");
   ObjectDelete("XBForexcH3 line");
   ObjectDelete("XBForexcH3 label");
   ObjectDelete("XBForexcL5 line");
   ObjectDelete("XBForexcL5 label");
   ObjectDelete("XBForexcL4 line");
   ObjectDelete("XBForexcL4 label");
   ObjectDelete("XBForexcL3 line");
   ObjectDelete("XBForexcL3 label");
   ObjectDelete("change_label");
   ObjectDelete("change_value_label");
   ObjectDelete("hilo_label");
   ObjectDelete("hilo_value_label");
   ObjectDelete("dav_label");
   ObjectDelete("dav_value_label");
   ObjectDelete("highest_label");
   ObjectDelete("highest_value_label");
   ObjectDelete("lowest_label");
   ObjectDelete("lowest_value_label");
   ObjectDelete("spread_label");
   ObjectDelete("spread_value_label");
   ObjectDelete("buy_trap_label");
   ObjectDelete("buy_trap_value_label");
   ObjectDelete("sell_trap_label");
   ObjectDelete("sell_trap_value_label");
   Comment("");
}


void Makeline(string a_name_0, color a_color_8, double ad_12) {
   g_str2time_408 = StrToTime(TimeToStr(TimeCurrent(), TIME_DATE) + " 00:00");
   g_str2time_412 = StrToTime(TimeToStr(TimeCurrent(), TIME_DATE) + " 23:00");
   if (ObjectFind(a_name_0) != 0) ObjectCreate(a_name_0, OBJ_TREND, 0, 0, 0, 0);
   ObjectSet(a_name_0, OBJPROP_STYLE, STYLE_DOT);
   ObjectSet(a_name_0, OBJPROP_COLOR, a_color_8);
   ObjectSet(a_name_0, OBJPROP_WIDTH, 1);
   ObjectSet(a_name_0, OBJPROP_TIME1, g_str2time_408);
   ObjectSet(a_name_0, OBJPROP_TIME2, g_str2time_412);
   ObjectSet(a_name_0, OBJPROP_PRICE1, ad_12);
   ObjectSet(a_name_0, OBJPROP_PRICE2, ad_12);
   ObjectSet(a_name_0, OBJPROP_RAY, FALSE);
}

void Makelabel(string a_name_0, string a_text_8, color a_color_16, double ad_20, int ai_28) {
   if (ObjectFind(a_name_0) != 0) ObjectCreate(a_name_0, OBJ_TEXT, 0, 0, 0);
   ObjectMove(a_name_0, 0, Time[0], ad_20 + ai_28 * gd_400);
   ObjectSetText(a_name_0, a_text_8, 8, "arial", a_color_16);
}

void creataalltext() {
   int li_0 = 65535;
   createtext("spread_label");
   settext("spread_label", "Spread:", 8, li_0, 5, 60);
   createtext("spread_value_label");
   createtext("highest_label");
   settext("highest_label", "Today Highest:", 8, li_0, 5, 80);
   createtext("highest_value_label");
   createtext("change_label");
   settext("change_label", "Change:", 8, li_0, 5, 100);
   createtext("change_value_label");
   createtext("lowest_label");
   settext("lowest_label", "Today Lowest:", 8, li_0, 5, 120);
   createtext("lowest_value_label");
   createtext("hilo_label");
   settext("hilo_label", "Hi to Low:", 8, li_0, 5, 140);
   createtext("hilo_value_label");
   createtext("dav_label");
   settext("dav_label", "Daily Average:", 8, li_0, 5, 150);
   createtext("dav_value_label");
   createtext("buy_trap_label");
   settext("buy_trap_label", "Buy Trap: ", 8, li_0, 5, 170);
   createtext("buy_trap_value_label");
   createtext("sell_trap_label");
   settext("sell_trap_label", "Sell Trap: ", 8, li_0, 5, 190);
   createtext("sell_trap_value_label");
}

void createtext(string a_name_0) {
   ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0);
}

void settext(string a_name_0, string a_text_8, int a_fontsize_16, color a_color_20, int a_x_24, int a_y_28) {
   ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_24);
   ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_28);
   ObjectSetText(a_name_0, a_text_8, a_fontsize_16, "Arial", a_color_20);
}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---