Navigation:Home > Content >

VSAc_MULTY_VOLUME_HISTOGRAM_mod1.mq4

Time: 2014-08-16 | Download file:VSAc_MULTY_VOLUME_HISTOGRAM_mod1.mq4

#property copyright "Copyright © 2008, FOREXflash Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 DeepSkyBlue
#property indicator_color3 Yellow
#property indicator_color4 Lime
#property indicator_color5 White
#property indicator_color6 Fuchsia
#property indicator_color7 Gray
#property indicator_color8 DarkOrange

extern int NumberOfBars = 500;
extern int MAPeriod = 100;
extern int LookBack = 20;
extern bool ShowText = TRUE;
extern int Corner = 1;
extern bool ShowOCLines = TRUE;
extern int OCPeriod = 14;
extern bool ShowBarTime = TRUE;
extern color Trending = C'0x23,0x23,0x23';
extern color Ranging = Black;
string gGfontnameP116 = "Trebuchet MS";
int gGfontsizeP124 = 13;
int gGcolorP128 = White;
int gGxP132 = 15;
int gGyP136 = 35;
bool giP140 = TRUE;
int gGcolorP144 = Black;
int gGfontsizeP148 = 20;
string gGfontnameP152 = "Arial Black";
int giPunusedP160 = 1;
int gGstrPlenP164;
string gsP168 = ":...:...:...:...:";
double gdP176;
double gdP184;
double gGibufP192[];
double gGibufP196[];
double gGibufP200[];
double gGibufP204[];
double gGibufP208[];
double gGibufP212[];
double gGibufP216[];
double gGibufP220[];
double gGbidP224;
bool giP232 = TRUE;
int gGtimeframeP236 = 0;
int gGshiftP240 = -1;

int init() {
  
   SetIndexBuffer(0, gGibufP192);
   SetIndexStyle(0, DRAW_HISTOGRAM);
   SetIndexLabel(0, "Climax High ");
   SetIndexBuffer(1, gGibufP196);
   SetIndexStyle(1, DRAW_HISTOGRAM);
   SetIndexLabel(1, "Neutral");
   SetIndexBuffer(2, gGibufP200);
   SetIndexStyle(2, DRAW_HISTOGRAM);
   SetIndexLabel(2, "Low ");
   SetIndexBuffer(3, gGibufP204);
   SetIndexStyle(3, DRAW_HISTOGRAM);
   SetIndexLabel(3, "HighChurn ");
   SetIndexBuffer(4, gGibufP208);
   SetIndexStyle(4, DRAW_HISTOGRAM);
   SetIndexLabel(4, "Climax Low ");
   SetIndexBuffer(5, gGibufP212);
   SetIndexStyle(5, DRAW_HISTOGRAM);
   SetIndexLabel(5, "ClimaxChurn ");
   SetIndexBuffer(6, gGibufP216);
   SetIndexStyle(6, DRAW_LINE, STYLE_DOT, 1);
   SetIndexLabel(6, "Average(" + MAPeriod + ")");
   SetIndexBuffer(7, gGibufP220);
   SetIndexStyle(7, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexLabel(7, "TickSeparateVolume");
   IndicatorShortName("VSA© MULTY VOLUME HISTOGRAM");
   if (ShowText == TRUE) draw_objects();
   return (0);
}

int deinit() {
   string lPnameP4;
   for (int liP0 = ObjectsTotal() - 1; liP0 >= 0; liP0--) {
      lPnameP4 = ObjectName(liP0);
      if (StringSubstr(lPnameP4, 0, 8) == "Trend2") ObjectDelete(lPnameP4);
   }
   if (ObjectFind("BarTimer1") != -1) ObjectDelete("BarTimer1");
   ObjectDelete("Market_Price_Label1");
   ObjectsDeleteAll(0, OBJ_LABEL);
   return (0);
}

int BarTimer() {
   int liP0 = 0;
   int liP4 = 0;
   double ldP8 = 0.0;
   string l_str_concatP16 = "";
   string lsP24 = "";
   string lsP32 = "";
   ObjectCreate("BarTimer1", OBJ_LABEL, WindowFind("VSA© MULTY VOLUME HISTOGRAM"), 0, 0);
   ObjectSet("BarTimer1", OBJPROP_CORNER, Corner);
   ObjectSet("BarTimer1", OBJPROP_XDISTANCE, gGxP132);
   ObjectSet("BarTimer1", OBJPROP_YDISTANCE, gGyP136);
   liP4 = TimeCurrent() - Time[0];
   liP0 = (gGstrPlenP164 - 1) * liP4 / (60 * Period());
   ldP8 = 100.0 * liP4 / (60 * Period());
   if (liP0 > gGstrPlenP164 - 1) liP0 = gGstrPlenP164 - 1;
   if (liP0 > 0) lsP32 = StringSubstr(gsP168, 0, liP0);
   if (liP0 < gGstrPlenP164 - 1) lsP24 = StringSubstr(gsP168, liP0 + 1, gGstrPlenP164 - liP0 - 1);
   l_str_concatP16 = StringConcatenate(lsP32, "|", lsP24, "  ", DoubleToStr(ldP8, 0), "%");
   ObjectSetText("BarTimer1", l_str_concatP16, gGfontsizeP124, gGfontnameP116, gGcolorP128);
   return (0);
}

int MPrice() {
   int liP0;
   if (giP140 == TRUE) {
      if (Bid > gGbidP224) gGcolorP144 = LawnGreen;
      if (Bid < gGbidP224) gGcolorP144 = Red;
      gGbidP224 = Bid;
   }
   string lsP4 = StringSubstr(Symbol(), 3, 3);
   if (lsP4 == "JPY") liP0 = 2;
   else liP0 = 4;
   string l_dbl2strP12 = DoubleToStr(Bid, liP0);
   ObjectCreate("Market_Price_Label1", OBJ_LABEL, WindowFind("VSA© MULTY VOLUME HISTOGRAM"), 0, 0);
   ObjectSetText("Market_Price_Label1", l_dbl2strP12, gGfontsizeP148, gGfontnameP152, gGcolorP144);
   ObjectSet("Market_Price_Label1", OBJPROP_CORNER, Corner);
   ObjectSet("Market_Price_Label1", OBJPROP_XDISTANCE, 15);
   ObjectSet("Market_Price_Label1", OBJPROP_YDISTANCE, 144);
   return (0);
}

int start() {
   double l_volumeP16;
   double ldP24;
   double ldP32;
   double ldP40;
   double ldP48;
   double ldP56;
   double ldP64;
   double ldP72;
   double ldP80;
   double ldP88;
   string lPnameP112;
   
   TickVolumeDiff();
   if (ShowText == TRUE) {
      draw_objects();
      BarTimer();
      MPrice();
   }
   if (ShowOCLines == TRUE) OpenCloseLines();
   if (ShowBarTime == TRUE) BarTime();
   int l_windowP12 = WindowFind("VSA© MULTY VOLUME HISTOGRAM");
   int liP100 = IndicatorCounted();
   if (liP100 > 0) liP100--;
   if (NumberOfBars == 0) NumberOfBars = Bars - liP100;
   int liP96 = NumberOfBars;
   for (int liP104 = 0; liP104 < liP96; liP104++) {
      gGibufP192[liP104] = 0;
      gGibufP196[liP104] = Volume[liP104];
      gGibufP200[liP104] = 0;
      gGibufP204[liP104] = 0;
      gGibufP208[liP104] = 0;
      gGibufP212[liP104] = 0;
      ldP32 = 0;
      ldP40 = 0;
      ldP48 = 0;
      ldP56 = 0;
      ldP64 = 99999999;
      ldP72 = 0;
      ldP80 = 0;
      ldP88 = 0;
      l_volumeP16 = Volume[iLowest(NULL, 0, MODE_VOLUME, 20, liP104)];
      if (Volume[liP104] == l_volumeP16) {
         gGibufP200[liP104] = NormalizeDouble(Volume[liP104], 0);
         gGibufP196[liP104] = 0;
      }
      ldP24 = High[liP104] - Low[liP104];
      ldP32 = Volume[liP104] * ldP24;
      if (ldP24 != 0.0) ldP40 = Volume[liP104] / ldP24;
      for (int liP108 = liP104; liP108 < liP104 + MAPeriod; liP108++) ldP88 = Volume[liP108] + ldP88;
      gGibufP216[liP104] = NormalizeDouble(ldP88 / MAPeriod, 0);
      for (liP108 = liP104; liP108 < liP104 + LookBack; liP108++) {
         ldP72 = Volume[liP108] * (High[liP108] - Low[liP108]);
         if (ldP72 >= ldP48) ldP48 = ldP72;
         if (Volume[liP108] * (High[liP108] - Low[liP108]) != 0.0) {
            ldP80 = Volume[liP108] / (High[liP108] - Low[liP108]);
            if (ldP80 > ldP56) ldP56 = ldP80;
            if (ldP80 < ldP64) ldP64 = ldP80;
         }
      }
      if (ldP32 == ldP48 && Close[liP104] > (High[liP104] + Low[liP104]) / 2.0) {
         gGibufP192[liP104] = NormalizeDouble(Volume[liP104], 0);
         gGibufP196[liP104] = 0;
         gGibufP200[liP104] = 0;
      }
      if (ldP40 == ldP56) {
         gGibufP204[liP104] = NormalizeDouble(Volume[liP104], 0);
         gGibufP196[liP104] = 0;
         gGibufP200[liP104] = 0;
         gGibufP192[liP104] = 0;
      }
      if (ldP32 == ldP48 && ldP40 == ldP56) {
         gGibufP212[liP104] = NormalizeDouble(Volume[liP104], 0);
         gGibufP196[liP104] = 0;
         gGibufP192[liP104] = 0;
         gGibufP204[liP104] = 0;
         gGibufP200[liP104] = 0;
      }
      if (ldP32 == ldP48 && Close[liP104] <= (High[liP104] + Low[liP104]) / 2.0) {
         gGibufP208[liP104] = NormalizeDouble(Volume[liP104], 0);
         gGibufP212[liP104] = 0;
         gGibufP196[liP104] = 0;
         gGibufP192[liP104] = 0;
         gGibufP204[liP104] = 0;
         gGibufP200[liP104] = 0;
      }
   }
   int l_countP120 = 0;
   for (liP104 = liP96 - 1; liP104 > 0; liP104--) {
      if (Volume[liP104] > gGibufP216[liP104]) {
         l_countP120++;
         lPnameP112 = "Trend2" + l_countP120;
         if (ObjectFind(lPnameP112) == -1) ObjectCreate(lPnameP112, OBJ_RECTANGLE, l_windowP12, 0, 0);
         ObjectSet(lPnameP112, OBJPROP_COLOR, Ranging);
         ObjectSet(lPnameP112, OBJPROP_PRICE1, 100000000);
         ObjectSet(lPnameP112, OBJPROP_PRICE2, -100000000);
         ObjectSet(lPnameP112, OBJPROP_TIME1, Time[liP104]);
         ObjectSet(lPnameP112, OBJPROP_TIME2, Time[liP104 - 1]);
      } else {
         if (Volume[liP104] < gGibufP216[liP104]) {
            l_countP120++;
            lPnameP112 = "Trend2" + l_countP120;
            if (ObjectFind(lPnameP112) == -1) ObjectCreate(lPnameP112, OBJ_RECTANGLE, l_windowP12, 0, 0);
            ObjectSet(lPnameP112, OBJPROP_COLOR, Trending);
            ObjectSet(lPnameP112, OBJPROP_PRICE1, 100000000);
            ObjectSet(lPnameP112, OBJPROP_PRICE2, -100000000);
            ObjectSet(lPnameP112, OBJPROP_TIME1, Time[liP104]);
            ObjectSet(lPnameP112, OBJPROP_TIME2, Time[liP104 - 1]);
         } else ObjectSet(lPnameP112, OBJPROP_TIME2, Time[liP104 - 1]);
      }
   }
   return (0);
}

void TickVolumeDiff() {
   int l_shiftP4;
   for (int liP0 = 0; liP0 < iBars(Symbol(), PERIOD_M1); liP0++) {
      l_shiftP4 = iBarShift(Symbol(), Period(), iTime(Symbol(), PERIOD_M1, liP0), TRUE);
      if (gGshiftP240 != l_shiftP4) {
         gdP176 = 0;
         gdP184 = 0;
         gGibufP220[l_shiftP4] = 0;
      }
      if (l_shiftP4 != -1) {
         if (iClose(Symbol(), PERIOD_M1, liP0) > iClose(Symbol(), PERIOD_M1, liP0 + 1)) gdP176 += iVolume(Symbol(), PERIOD_M1, liP0);
         if (iClose(Symbol(), PERIOD_M1, liP0) < iClose(Symbol(), PERIOD_M1, liP0 + 1)) gdP184 -= iVolume(Symbol(), PERIOD_M1, liP0);
         if (iClose(Symbol(), PERIOD_M1, liP0) == iClose(Symbol(), PERIOD_M1, liP0 + 1)) {
            gdP176 += iVolume(Symbol(), PERIOD_M1, liP0) / 2.0;
            gdP184 -= iVolume(Symbol(), PERIOD_M1, liP0) / 2.0;
         }
      }
      gGibufP220[l_shiftP4] = (gdP176 + gdP184) / 2.0;
      gGshiftP240 = l_shiftP4;
   }
}

void draw_objects() {
   //ObjectCreate("VBox", OBJ_LABEL, WindowFind("VSA© MULTY VOLUME HISTOGRAM"), 0, 0);
   //ObjectSetText("VBox", "V  S  A  ®", 14, "Trebuchet MS", Orange);
   //ObjectSet("VBox", OBJPROP_CORNER, Corner);
   //ObjectSet("VBox", OBJPROP_XDISTANCE, 15);
   //ObjectSet("VBox", OBJPROP_YDISTANCE, 1);
   //ObjectCreate("VBox1", OBJ_LABEL, WindowFind("VSA© MULTY VOLUME HISTOGRAM"), 0, 0);
   //ObjectSetText("VBox1", "Better/Tick Separate Volume", 8, "Trebuchet MS", Gray);
   //ObjectSet("VBox1", OBJPROP_CORNER, Corner);
   //ObjectSet("VBox1", OBJPROP_XDISTANCE, 15);
   //ObjectSet("VBox1", OBJPROP_YDISTANCE, 18);
   string l_dbl2strP0 = DoubleToStr(gGibufP220[0], 1);
   ObjectCreate("TSV", OBJ_LABEL, WindowFind("VSA© MULTY VOLUME HISTOGRAM"), 0, 0);
   ObjectSetText("TSV", "TICK SEPARATE VOLUME: " + l_dbl2strP0 + "", 13, "Trebuchet MS", White);
   ObjectSet("TSV", OBJPROP_CORNER, Corner);
   ObjectSet("TSV", OBJPROP_XDISTANCE, 15);
   ObjectSet("TSV", OBJPROP_YDISTANCE, 58);
   if (gGibufP220[0] >= 1.0) ObjectSetText("TSV", "ТИКОВЫЙ ОБЪЕМ: " + l_dbl2strP0 + "", 13, "Trebuchet MS", Lime);
   if (gGibufP220[0] <= 1.0) ObjectSetText("TSV", "ТИКОВЫЙ ОБЪЕМ: " + l_dbl2strP0 + "", 13, "Trebuchet MS", Red);
   ObjectCreate("TSV2", OBJ_LABEL, WindowFind("VSA© MULTY VOLUME HISTOGRAM"), 0, 0);
   ObjectSetText("TSV2", "ТИКОВЫЙ ОБЪЕМ НИЖЕ СРЕДНЕГО.", 8, "Trebuchet MS", White);
   ObjectSet("TSV2", OBJPROP_CORNER, Corner);
   ObjectSet("TSV2", OBJPROP_XDISTANCE, 15);
   ObjectSet("TSV2", OBJPROP_YDISTANCE, 76);
   if (gGibufP220[0] > gGibufP220[1] && gGibufP220[0] > gGibufP220[2] && gGibufP220[0] > gGibufP220[3] && gGibufP220[0] > gGibufP220[4] && gGibufP220[0] > gGibufP220[5] &&
      gGibufP220[0] > gGibufP220[6] && gGibufP220[0] > gGibufP220[7] && gGibufP220[0] > gGibufP220[8] && gGibufP220[0] > gGibufP220[9] && gGibufP220[0] > gGibufP220[10]) ObjectSetText("TSV2", "ТИКОВЫЙ ОБЪЕМ ВЫШЕ СРЕДНЕГО!!!", 8, "Trebuchet MS", Orange);
   string l_dbl2strP8 = DoubleToStr(gGibufP216[0], 1);
   ObjectCreate("v4MA", OBJ_LABEL, WindowFind("VSA© MULTY VOLUME HISTOGRAM"), 0, 0);
   ObjectSetText("v4MA", "СРЕДНИЙ ОБЪЕМ:" + l_dbl2strP8, 13, "Trebuchet MS", Lime);
   ObjectSet("v4MA", OBJPROP_CORNER, Corner);
   ObjectSet("v4MA", OBJPROP_XDISTANCE, 15);
   ObjectSet("v4MA", OBJPROP_YDISTANCE, 92);
   ObjectCreate("BaPv4MA", OBJ_LABEL, WindowFind("VSA© MULTY VOLUME HISTOGRAM"), 0, 0);
   ObjectSetText("BaPv4MA", "ОБЪЕМ НИЖЕ СРЕДНЕГО.", 8, "Trebuchet MS", White);
   ObjectSet("BaPv4MA", OBJPROP_CORNER, Corner);
   ObjectSet("BaPv4MA", OBJPROP_XDISTANCE, 15);
   ObjectSet("BaPv4MA", OBJPROP_YDISTANCE, 110);
   if (gGibufP216[0] > gGibufP216[1] && gGibufP216[0] > gGibufP216[2] && gGibufP216[0] > gGibufP216[3] && gGibufP216[0] > gGibufP216[4] && gGibufP216[0] > gGibufP216[5] &&
      gGibufP216[0] > gGibufP216[6] && gGibufP216[0] > gGibufP216[7] && gGibufP216[0] > gGibufP216[8] && gGibufP216[0] > gGibufP216[9] && gGibufP216[0] > gGibufP216[10] &&
      gGibufP216[0] > gGibufP216[11] && gGibufP216[0] > gGibufP216[12] && gGibufP216[0] > gGibufP216[13] && gGibufP216[0] > gGibufP216[14] && gGibufP216[0] > gGibufP216[15] &&
      gGibufP216[0] > gGibufP216[16] && gGibufP216[0] > gGibufP216[17] && gGibufP216[0] > gGibufP216[18] && gGibufP216[0] > gGibufP216[19] && gGibufP216[0] > gGibufP216[20]) ObjectSetText("BaPv4MA", "ОБЪЕМ ВЫШЕ СРЕДНЕГО!!!", 8, "Trebuchet MS", Red);
   ObjectCreate("BetterVol", OBJ_LABEL, WindowFind("VSA© MULTY VOLUME HISTOGRAM"), 0, 0);
   ObjectSetText("BetterVol", "ОЖИДАЮ СИГНАЛ...", 13, "Trebuchet MS", Gray);
   ObjectSet("BetterVol", OBJPROP_CORNER, Corner);
   //ObjectSet("BetterVol", OBJPROP_XDISTANCE, 15);
   //ObjectSet("BetterVol", OBJPROP_YDISTANCE, 127);
   ObjectSet("BetterVol", OBJPROP_XDISTANCE, 15);
   ObjectSet("BetterVol", OBJPROP_YDISTANCE, 1);
   if (gGibufP208[1] > 1.0) ObjectSetText("BetterVol", "*Начало/конец коррекции вниз при тренде вверх*", 10, "Trebuchet MS", White);
   if (gGibufP192[1] > 1.0) ObjectSetText("BetterVol", "*Начало/конец коррекции вверх при тренде вниз*", 10, "Trebuchet MS", Red);
   if (gGibufP204[1] > 1.0) ObjectSetText("BetterVol", "*Фиксация профита в середине тренда*", 10, "Trebuchet MS", Lime);
   if (gGibufP212[1] > 1.0) ObjectSetText("BetterVol", "*Консолидация. Возможен реверс или продолжение.*", 10, "Trebuchet MS", Fuchsia);
   if (gGibufP200[1] > 1.0) ObjectSetText("BetterVol", "*Завершение коррекции в середине тренда*", 10, "Trebuchet MS", Yellow);
   if (gGibufP196[1] > 1.0) ObjectSetText("BetterVol", "*Нет сигнала*", 10, "Trebuchet MS", DeepSkyBlue);
}

int OpenCloseLines() {
   double l_icloseP0 = iClose(NULL, PERIOD_D1, iHighest(NULL, PERIOD_D1, MODE_CLOSE, OCPeriod, 1));
   double l_icloseP8 = iClose(NULL, PERIOD_H4, iHighest(NULL, PERIOD_H4, MODE_CLOSE, OCPeriod, 1));
   double l_icloseP16 = iClose(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_CLOSE, OCPeriod, 1));
   double l_icloseP24 = iClose(NULL, PERIOD_M30, iHighest(NULL, PERIOD_M30, MODE_CLOSE, OCPeriod, 1));
   double l_icloseP32 = iClose(NULL, PERIOD_M15, iHighest(NULL, PERIOD_M15, MODE_CLOSE, OCPeriod, 1));
   double l_icloseP40 = iClose(NULL, PERIOD_D1, iLowest(NULL, PERIOD_D1, MODE_CLOSE, OCPeriod, 1));
   double l_icloseP48 = iClose(NULL, PERIOD_H4, iLowest(NULL, PERIOD_H4, MODE_CLOSE, OCPeriod, 1));
   double l_icloseP56 = iClose(NULL, PERIOD_H1, iLowest(NULL, PERIOD_H1, MODE_CLOSE, OCPeriod, 1));
   double l_icloseP64 = iClose(NULL, PERIOD_M30, iLowest(NULL, PERIOD_M30, MODE_CLOSE, OCPeriod, 1));
   double l_icloseP72 = iClose(NULL, PERIOD_M15, iLowest(NULL, PERIOD_M15, MODE_CLOSE, OCPeriod, 1));
   drawLine("HH_D1", Time[36], Time[30], l_icloseP0, l_icloseP0, 3, FALSE, Lime, 1);
   drawLine("HH_H4", Time[30], Time[24], l_icloseP8, l_icloseP8, 3, FALSE, Lime, 1);
   drawLine("HH_H1", Time[18], Time[12], l_icloseP16, l_icloseP16, 3, FALSE, Lime, 2);
   drawLine("HH_M30", Time[12], Time[6], l_icloseP24, l_icloseP24, 3, FALSE, Lime, 2);
   drawLine("HH_M15", Time[6], Time[0], l_icloseP32, l_icloseP32, 3, FALSE, Lime, 1);
   drawLine("LL_D1", Time[36], Time[30], l_icloseP40, l_icloseP40, 3, FALSE, Red, 1);
   drawLine("LL_H4", Time[30], Time[24], l_icloseP48, l_icloseP48, 3, FALSE, Red, 1);
   drawLine("LL_H1", Time[18], Time[12], l_icloseP56, l_icloseP56, 3, FALSE, Red, 2);
   drawLine("LL_M30", Time[12], Time[6], l_icloseP64, l_icloseP64, 3, FALSE, Red, 2);
   drawLine("LL_M15", Time[6], Time[0], l_icloseP72, l_icloseP72, 3, FALSE, Red, 1);
   drawTXTLabel("D1 Bar HC", l_icloseP0, Time[33], White);
   drawTXTLabel("H4 Bar HC", l_icloseP8, Time[27], White);
   drawTXTLabel("H1 Bar HC", l_icloseP16, Time[15], White);
   drawTXTLabel("M30 Bar HC", l_icloseP24, Time[9], White);
   drawTXTLabel("M15 Bar HC", l_icloseP32, Time[3], White);
   drawTXTLabel("D1 Bar LC", l_icloseP40, Time[33], White);
   drawTXTLabel("H4 Bar LC", l_icloseP48, Time[27], White);
   drawTXTLabel("H1 Bar LC", l_icloseP56, Time[15], White);
   drawTXTLabel("M30 Bar LC", l_icloseP64, Time[9], White);
   drawTXTLabel("M15 Bar LC", l_icloseP72, Time[3], White);
   return (0);
}

void drawTXTLabel(string aPnameP0, double aPpriceP8, int aPdatetimeP16, color aPcolorP20) {
   if (ObjectFind(aPnameP0) != 0) {
      ObjectCreate(aPnameP0, OBJ_TEXT, 0, aPdatetimeP16, aPpriceP8);
      ObjectSetText(aPnameP0, aPnameP0, 8, "Tahoma", CLR_NONE);
      ObjectSet(aPnameP0, OBJPROP_COLOR, aPcolorP20);
      return;
   }
   ObjectMove(aPnameP0, 0, aPdatetimeP16, aPpriceP8);
}

void drawLine(string aPnameP0, int aPdatetimeP8, int aPdatetimeP12, double aPpriceP16, double aPpriceP24, int aiPunusedP32, int aPboolP36, color aPcolorP40, int aiP44) {
   if (ObjectFind(aPnameP0) != 0) {
      ObjectCreate(aPnameP0, OBJ_TREND, 0, aPdatetimeP8, aPpriceP16, aPdatetimeP12, aPpriceP24);
      if (aiP44 == 1) ObjectSet(aPnameP0, OBJPROP_STYLE, STYLE_SOLID);
      else {
         if (aiP44 == 2) ObjectSet(aPnameP0, OBJPROP_STYLE, STYLE_DASHDOT);
         else ObjectSet(aPnameP0, OBJPROP_STYLE, STYLE_DOT);
      }
      ObjectSet(aPnameP0, OBJPROP_COLOR, aPcolorP40);
      ObjectSet(aPnameP0, OBJPROP_WIDTH, 2);
      ObjectSet(aPnameP0, OBJPROP_RAY, aPboolP36);
      return;
   }
   ObjectDelete(aPnameP0);
   ObjectCreate(aPnameP0, OBJ_TREND, 0, aPdatetimeP8, aPpriceP16, aPdatetimeP12, aPpriceP24);
   if (aiP44 == 1) ObjectSet(aPnameP0, OBJPROP_STYLE, STYLE_SOLID);
   else {
      if (aiP44 == 2) ObjectSet(aPnameP0, OBJPROP_STYLE, STYLE_DASHDOT);
      else ObjectSet(aPnameP0, OBJPROP_STYLE, STYLE_DOT);
   }
   ObjectSet(aPnameP0, OBJPROP_COLOR, aPcolorP40);
   ObjectSet(aPnameP0, OBJPROP_WIDTH, 2);
   ObjectSet(aPnameP0, OBJPROP_RAY, aPboolP36);
}

void BarTime() {
   if (gGtimeframeP236 == 0) gGtimeframeP236 = Period();
   int liP64 = iTime(NULL, gGtimeframeP236, 0) + 60 * gGtimeframeP236 - TimeCurrent();
   int liP80 = iTime(NULL, PERIOD_D1, 0) + 86400 - TimeCurrent();
   int liP84 = iTime(NULL, PERIOD_H4, 0) + 14400 - TimeCurrent();
   int liP88 = iTime(NULL, PERIOD_H1, 0) + 3600 - TimeCurrent();
   int liP92 = iTime(NULL, PERIOD_M30, 0) + 1800 - TimeCurrent();
   int liP96 = iTime(NULL, PERIOD_M15, 0) + 900 - TimeCurrent();
   int liP100 = iTime(NULL, PERIOD_M5, 0) + 300 - TimeCurrent();
   int liP104 = iTime(NULL, PERIOD_M1, 0) + 60 - TimeCurrent();
   double ldP0 = liP64 / 60.0;
   double ldP8 = liP80 / 60.0;
   double ldP16 = liP84 / 60.0;
   double ldP24 = liP88 / 60.0;
   double ldP32 = liP92 / 60.0;
   double ldP40 = liP96 / 60.0;
   double ldP48 = liP100 / 60.0;
   double aiP56 = liP104 / 60.0;
   int liP68 = liP64 % 60;
   int liP108 = liP64 % 60;
   int liP112 = liP80 % 60;
   int liP116 = liP84 % 60;
   int liP120 = liP88 % 60;
   int liP124 = liP92 % 60;
   int liP128 = liP96 % 60;
   int liP132 = liP100 % 60;
   int liP136 = liP104 % 60;
   liP64 = (liP64 - liP64 % 60) / 60;
   int liP76 = (liP64 - liP64 % 60) / 60;
   liP80 = (liP80 - liP80 % 60) / 60;
   liP84 = (liP84 - liP84 % 60) / 60;
   liP88 = (liP88 - liP88 % 60) / 60;
   liP92 = (liP92 - liP92 % 60) / 60;
   liP96 = (liP96 - liP96 % 60) / 60;
   liP100 = (liP100 - liP100 % 60) / 60;
   liP104 = (liP104 - liP104 % 60) / 60;
   int liP140 = liP64 / 60;
   int liP144 = liP80 / 60;
   int liP148 = liP84 / 60;
   int liP152 = liP88 / 60;
   int liP156 = liP92 / 60;
   int liP160 = liP96 / 60;
   int liP164 = liP100 / 60;
   int liP168 = liP104 / 60;
   string lsP172 = "                   <" + liP64 + ":" + liP68;
   string lsP180 = "[M1] " + liP104 + "m :" + liP136;
   string lsP188 = "[M5] " + liP100 + "m :" + liP132;
   string lsP196 = "[M15] " + liP96 + "m :" + liP128;
   string lsP204 = "[M30] " + liP92 + "m :" + liP124;
   string lsP212 = "[M60] " + liP88 + "m :" + liP120;
   string lsP220 = "[H4] " + liP84 + "m :" + liP116;
   string lsP228 = "[D1] " + liP80 + "m :" + liP112;
   ObjectDelete("time");
   if (ObjectFind("time") != 0) {
      if (giP232) {
         ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0] + 0.0);
         ObjectsRedraw();
      }
      if (giP232) {
         ObjectSetText("time", StringSubstr(lsP172, 0), 9, "Tahoma", White);
         ObjectsRedraw();
      }
   } else ObjectMove("time", 0, Time[0], Close[0] + 0.0005);
}

Recommend