//+------------------------------------------------------------------+ //| Magnified Market Price.mq4 ver1.4 by Habeeb | //| | //| Modified by Robert Hill to output any of 5 values | //| Current Bid | //| Difference = Bid - Yesterdays close | //| Percent = (Difference / Yesterdays close ) * 100 | //| Current spread | //| User Text | //+------------------------------------------------------------------+ #property indicator_chart_window //---- extern string w = "Which Price?"; extern string w1 = " 1. Bid"; extern string w2 = " 2. Difference"; extern string w3 = " 3. Percent"; extern string w4 = " 4. Current Spread"; extern string w5 = " 5. User Text"; extern int which = 1; extern string UserText = "MyTemplate"; extern string note1="Change font colors automatically? True = Yes"; extern bool Bid_Ask_Colors=True; extern string note2="Default Font Color"; extern color FontColor=Red; extern string note3="Font Size"; extern int FontSize=32; extern string note4="Font Type"; extern string FontType="Arial Black"; 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=1; //---- double myPoint; double Old_Price; string LabelID; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { LabelID = "Market_Price_Label" + DoubleToStr(which,0); myPoint = SetPoint(); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { ObjectDelete(LabelID); //---- return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { string Market_Price; double myClose, PriceDif, PricePercent; double spread; switch (which) { case 1 : Market_Price="Bid : " + DoubleToStr(Bid, Digits); if (Bid_Ask_Colors==True) { if (Bid > Old_Price) FontColor=LawnGreen; if (Bid < Old_Price) FontColor=Red; Old_Price=Bid; } break; case 2 : myClose = iClose(NULL, PERIOD_D1, 1); PriceDif = Bid - myClose; Market_Price = "Dif : " + DoubleToStr(PriceDif, Digits); if (Bid_Ask_Colors==True) { if (Bid > myClose) FontColor=LawnGreen; else FontColor=Red; } break; case 3 : myClose = iClose(NULL, PERIOD_D1, 1); PricePercent = ((Bid - myClose) / myClose)* 100.0; Market_Price = "Percent : " + DoubleToStr(PricePercent, Digits); if (Bid_Ask_Colors==True) { if (Bid > myClose) FontColor=LawnGreen; else FontColor=Red; } break; case 4 : spread = (Ask - Bid) / myPoint; Market_Price = "Spread : " + DoubleToStr(spread,1); if (Bid_Ask_Colors==True) FontColor = LawnGreen; break; case 5 : Market_Price = UserText; } //---- ObjectCreate(LabelID, OBJ_LABEL, 0, 0, 0); ObjectSetText(LabelID, Market_Price, FontSize, FontType, FontColor); ObjectSet(LabelID, OBJPROP_CORNER, WhatCorner); ObjectSet(LabelID, OBJPROP_XDISTANCE, 1); ObjectSet(LabelID, OBJPROP_YDISTANCE, 1); } double SetPoint() { double mPoint; if (Digits < 4) mPoint = 0.01; else mPoint = 0.0001; return(mPoint); } //+------------------------------------------------------------------+