/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Jeff"
#property link      "wolfboy@att.net"

#property indicator_chart_window

extern string note1 = "Change font colors automatically? True = Yes";
extern bool Bid_Ask_Colors = TRUE;
extern bool ShowBid = TRUE;
extern bool ShowAsk = TRUE;
extern color DefaultColor = White;
extern color BidUpColor = Lime;
extern color BidDnColor = Red;
extern color AskUpColor = Lime;
extern color AskDnColor = Red;
extern string note3 = "Font Size";
extern int BidFontSize = 22;
extern int AskFontSize = 18;
extern string note4 = "Font Type";
extern string BidFontType = "Arial";
extern string AskFontType = "Arial";
extern string note5 = "Display the price in what corner?";
extern string note6 = "Upper left=0; Upper right=1";
extern string note7 = "Lower left=2; Lower right=3";
extern int WhatCorner = 3;
double g_ask_184;
double g_bid_192;

int init() {
   return (0);
}

int deinit() {
   ObjectDelete("Market_Ask_Price_Label");
   ObjectDelete("Market_Bid_Price_Label");
   return (0);
}

int start() {
   int l_y_0;
   int l_y_4;
   color l_color_8;
   color l_color_12;
   if (Bid_Ask_Colors == TRUE) {
      if (Ask > g_ask_184) l_color_8 = AskUpColor;
      if (Ask < g_ask_184) l_color_8 = AskDnColor;
      if (Ask == g_ask_184) l_color_8 = DefaultColor;
      if (Bid > g_bid_192) l_color_12 = BidUpColor;
      if (Bid < g_bid_192) l_color_12 = BidDnColor;
      if (Bid == g_bid_192) l_color_12 = DefaultColor;
      g_ask_184 = Ask;
      g_bid_192 = Bid;
   }
   if (Bid_Ask_Colors == FALSE) {
      if (Ask > g_ask_184) l_color_8 = DefaultColor;
      if (Ask < g_ask_184) l_color_8 = DefaultColor;
      if (Ask == g_ask_184) l_color_8 = DefaultColor;
      if (Bid > g_bid_192) l_color_12 = DefaultColor;
      if (Bid < g_bid_192) l_color_12 = DefaultColor;
      if (Bid == g_bid_192) l_color_12 = DefaultColor;
      g_ask_184 = Ask;
      g_bid_192 = Bid;
   }
   string l_dbl2str_16 = DoubleToStr(Ask, Digits);
   string l_dbl2str_24 = DoubleToStr(Bid, Digits);
   if (ShowBid == TRUE && ShowAsk == TRUE) {
      if (WhatCorner == 2 || WhatCorner == 3) {
         l_y_0 = BidFontSize + 8;
         l_y_4 = 1;
      }
      if (WhatCorner == 0 || WhatCorner == 1) {
         l_y_0 = 1;
         l_y_4 = AskFontSize + 8;
      }
      ObjectCreate("Market_Ask_Price_Label", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("Market_Ask_Price_Label", l_dbl2str_16, AskFontSize, AskFontType, l_color_8);
      ObjectSet("Market_Ask_Price_Label", OBJPROP_CORNER, WhatCorner);
      ObjectSet("Market_Ask_Price_Label", OBJPROP_XDISTANCE, 1);
      ObjectSet("Market_Ask_Price_Label", OBJPROP_YDISTANCE, l_y_0);
      ObjectCreate("Market_Bid_Price_Label", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("Market_Bid_Price_Label", l_dbl2str_24, BidFontSize, BidFontType, l_color_12);
      ObjectSet("Market_Bid_Price_Label", OBJPROP_CORNER, WhatCorner);
      ObjectSet("Market_Bid_Price_Label", OBJPROP_XDISTANCE, 1);
      ObjectSet("Market_Bid_Price_Label", OBJPROP_YDISTANCE, l_y_4);
   }
   if (ShowBid == TRUE && ShowAsk == FALSE) {
      l_y_4 = 1;
      ObjectCreate("Market_Bid_Price_Label", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("Market_Bid_Price_Label", l_dbl2str_24, BidFontSize, BidFontType, l_color_12);
      ObjectSet("Market_Bid_Price_Label", OBJPROP_CORNER, WhatCorner);
      ObjectSet("Market_Bid_Price_Label", OBJPROP_XDISTANCE, 1);
      ObjectSet("Market_Bid_Price_Label", OBJPROP_YDISTANCE, l_y_4);
   }
   if (ShowBid == FALSE && ShowAsk == TRUE) {
      l_y_0 = 1;
      ObjectCreate("Market_Ask_Price_Label", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("Market_Ask_Price_Label", l_dbl2str_16, AskFontSize, AskFontType, l_color_8);
      ObjectSet("Market_Ask_Price_Label", OBJPROP_CORNER, WhatCorner);
      ObjectSet("Market_Ask_Price_Label", OBJPROP_XDISTANCE, 1);
      ObjectSet("Market_Ask_Price_Label", OBJPROP_YDISTANCE, l_y_0);
   }
   return (0);
}
