#property copyright "Copyright © 2008, smjones"
#property link      "sjcoinc2000@yahoo.com"

#property indicator_chart_window

int G_fontsize_76 = 12;
extern int X_Location = 0;
extern int Y_Location = 10;
extern int ATRPeriod = 20;
extern color TextColor = Blue;
extern bool BidRatioOn = FALSE;
double G_pips_100 = 1.0;

int init() {
   if (Digits == 5 || Digits == 3) G_pips_100 = 10;
   ObjectCreate("com", OBJ_LABEL, 0, 0, 0);
   ObjectSet("com", OBJPROP_XDISTANCE, X_Location);
   ObjectSet("com", OBJPROP_YDISTANCE, Y_Location - 10);
   if (BidRatioOn) {
      ObjectCreate("BidRatiomn", OBJ_LABEL, 0, 0, 0);
      ObjectSet("BidRatiomn", OBJPROP_XDISTANCE, X_Location);
      ObjectSet("BidRatiomn", OBJPROP_YDISTANCE, Y_Location + 10);
      ObjectCreate("BidRatiowk", OBJ_LABEL, 0, 0, 0);
      ObjectSet("BidRatiowk", OBJPROP_XDISTANCE, X_Location);
      ObjectSet("BidRatiowk", OBJPROP_YDISTANCE, Y_Location + 30);
      ObjectCreate("BidRatiod1", OBJ_LABEL, 0, 0, 0);
      ObjectSet("BidRatiod1", OBJPROP_XDISTANCE, X_Location);
      ObjectSet("BidRatiod1", OBJPROP_YDISTANCE, Y_Location + 50);
      ObjectCreate("BidRatioh4", OBJ_LABEL, 0, 0, 0);
      ObjectSet("BidRatioh4", OBJPROP_XDISTANCE, X_Location);
      ObjectSet("BidRatioh4", OBJPROP_YDISTANCE, Y_Location + 70);
      ObjectCreate("BidRatioh1", OBJ_LABEL, 0, 0, 0);
      ObjectSet("BidRatioh1", OBJPROP_XDISTANCE, X_Location);
      ObjectSet("BidRatioh1", OBJPROP_YDISTANCE, Y_Location + 90);
      ObjectCreate("BidRatiom15", OBJ_LABEL, 0, 0, 0);
      ObjectSet("BidRatiom15", OBJPROP_XDISTANCE, X_Location);
      ObjectSet("BidRatiom15", OBJPROP_YDISTANCE, Y_Location + 110);
   }
   return (0);
}

int deinit() {
   ObjectDelete("com");
   ObjectDelete("BidRatiomn");
   ObjectDelete("BidRatiowk");
   ObjectDelete("BidRatiod1");
   ObjectDelete("BidRatioh4");
   ObjectDelete("BidRatioh1");
   ObjectDelete("BidRatiom15");
   Comment("");
   return (0);
}

int start() {
   double Ld_0;
   double Ld_8;
   double Ld_16;
   double Ld_24;
   double Ld_32;
   double Ld_40;
   string text_48 = "ATR" + ATRPeriod + " = " + DoubleToStr(iATR(NULL, 0, ATRPeriod, 0) / (Point * G_pips_100), 1) + " Range = " + DoubleToStr(iATR(NULL, PERIOD_D1,
      1, 0) / (Point * G_pips_100), 1) + " Spread = " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD) / G_pips_100, 1);
   ObjectSetText("com", text_48, 10, "Arial", TextColor);
   if (BidRatioOn) {
      Ld_0 = 100.0 * ((iClose(NULL, PERIOD_MN1, 0) - iLow(NULL, PERIOD_MN1, 0)) / (iHigh(NULL, PERIOD_MN1, 0) - iLow(NULL, PERIOD_MN1, 0)));
      if (Ld_0 < 25.0) ObjectSetText("BidRatiomn", "MN  " + DoubleToStr(Ld_0, 2) + "%", G_fontsize_76, "Arial", Red);
      if (Ld_0 > 75.0) ObjectSetText("BidRatiomn", "MN  " + DoubleToStr(Ld_0, 2) + "%", G_fontsize_76, "Arial", DodgerBlue);
      if (Ld_0 >= 25.0 && Ld_0 <= 50.0) ObjectSetText("BidRatiomn", "MN  " + DoubleToStr(Ld_0, 2) + "%", G_fontsize_76, "Arial", Yellow);
      if (Ld_0 > 50.0 && Ld_0 <= 75.0) ObjectSetText("BidRatiomn", "MN  " + DoubleToStr(Ld_0, 2) + "%", G_fontsize_76, "Arial", PaleGreen);
      Ld_8 = 100.0 * ((iClose(NULL, PERIOD_W1, 0) - iLow(NULL, PERIOD_W1, 0)) / (iHigh(NULL, PERIOD_W1, 0) - iLow(NULL, PERIOD_W1, 0)));
      if (Ld_8 < 25.0) ObjectSetText("BidRatiowk", "WK  " + DoubleToStr(Ld_8, 2) + "%", G_fontsize_76, "Arial", Red);
      if (Ld_8 > 75.0) ObjectSetText("BidRatiowk", "WK  " + DoubleToStr(Ld_8, 2) + "%", G_fontsize_76, "Arial", DodgerBlue);
      if (Ld_8 >= 25.0 && Ld_8 <= 50.0) ObjectSetText("BidRatiowk", "WK  " + DoubleToStr(Ld_8, 2) + "%", G_fontsize_76, "Arial", Yellow);
      if (Ld_8 > 50.0 && Ld_8 <= 75.0) ObjectSetText("BidRatiowk", "WK  " + DoubleToStr(Ld_8, 2) + "%", G_fontsize_76, "Arial", PaleGreen);
      Ld_16 = 100.0 * ((iClose(NULL, PERIOD_D1, 0) - iLow(NULL, PERIOD_D1, 0)) / (iHigh(NULL, PERIOD_D1, 0) - iLow(NULL, PERIOD_D1, 0)));
      if (Ld_16 < 25.0) ObjectSetText("BidRatiod1", "D1  " + DoubleToStr(Ld_16, 2) + "%", G_fontsize_76, "Arial", Red);
      if (Ld_16 > 75.0) ObjectSetText("BidRatiod1", "D1  " + DoubleToStr(Ld_16, 2) + "%", G_fontsize_76, "Arial", DodgerBlue);
      if (Ld_16 >= 25.0 && Ld_16 <= 50.0) ObjectSetText("BidRatiod1", "D1  " + DoubleToStr(Ld_16, 2) + "%", G_fontsize_76, "Arial", Yellow);
      if (Ld_16 > 50.0 && Ld_16 <= 75.0) ObjectSetText("BidRatiod1", "D1  " + DoubleToStr(Ld_16, 2) + "%", G_fontsize_76, "Arial", PaleGreen);
      Ld_24 = 100.0 * ((iClose(NULL, PERIOD_H4, 0) - iLow(NULL, PERIOD_H4, 0)) / (iHigh(NULL, PERIOD_H4, 0) - iLow(NULL, PERIOD_H4, 0)));
      if (Ld_24 < 25.0) ObjectSetText("BidRatioh4", "H4  " + DoubleToStr(Ld_24, 2) + "%", G_fontsize_76, "Arial", Red);
      if (Ld_24 > 75.0) ObjectSetText("BidRatioh4", "H4  " + DoubleToStr(Ld_24, 2) + "%", G_fontsize_76, "Arial", DodgerBlue);
      if (Ld_24 >= 25.0 && Ld_24 <= 50.0) ObjectSetText("BidRatioh4", "H4  " + DoubleToStr(Ld_24, 2) + "%", G_fontsize_76, "Arial", Yellow);
      if (Ld_24 > 50.0 && Ld_24 <= 75.0) ObjectSetText("BidRatioh4", "H4  " + DoubleToStr(Ld_24, 2) + "%", G_fontsize_76, "Arial", PaleGreen);
      Ld_32 = 100.0 * ((iClose(NULL, PERIOD_H1, 0) - iLow(NULL, PERIOD_H1, 0)) / (iHigh(NULL, PERIOD_H1, 0) - iLow(NULL, PERIOD_H1, 0)));
      if (Ld_32 < 25.0) ObjectSetText("BidRatioh1", "H1  " + DoubleToStr(Ld_32, 2) + "%", G_fontsize_76, "Arial", Red);
      if (Ld_32 > 75.0) ObjectSetText("BidRatioh1", "H1  " + DoubleToStr(Ld_32, 2) + "%", G_fontsize_76, "Arial", DodgerBlue);
      if (Ld_32 >= 25.0 && Ld_32 <= 50.0) ObjectSetText("BidRatioh1", "H1  " + DoubleToStr(Ld_32, 2) + "%", G_fontsize_76, "Arial", Yellow);
      if (Ld_32 > 50.0 && Ld_32 <= 75.0) ObjectSetText("BidRatioh1", "H1  " + DoubleToStr(Ld_32, 2) + "%", G_fontsize_76, "Arial", PaleGreen);
      Ld_40 = 100.0 * ((iClose(NULL, PERIOD_M15, 0) - iLow(NULL, PERIOD_M15, 0)) / (iHigh(NULL, PERIOD_M15, 0) - iLow(NULL, PERIOD_M15, 0)));
      if (Ld_40 < 25.0) ObjectSetText("BidRatiom15", "M15  " + DoubleToStr(Ld_40, 2) + "%", G_fontsize_76, "Arial", Red);
      if (Ld_40 > 75.0) ObjectSetText("BidRatiom15", "M15  " + DoubleToStr(Ld_40, 2) + "%", G_fontsize_76, "Arial", DodgerBlue);
      if (Ld_40 >= 25.0 && Ld_40 <= 50.0) ObjectSetText("BidRatiom15", "M15  " + DoubleToStr(Ld_40, 2) + "%", G_fontsize_76, "Arial", Yellow);
      if (Ld_40 > 50.0 && Ld_40 <= 75.0) ObjectSetText("BidRatiom15", "M15  " + DoubleToStr(Ld_40, 2) + "%", G_fontsize_76, "Arial", PaleGreen);
   }
   return (0);
}
