//+------------------------------------------------------------------+
//| Magnified_Market_Price.mq5 |
//| Copyright 2016, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots 0
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
const bool Bid_Ask_Colors=true;
color FontColor=clrRed;
const int FontSize=24;
const string FontType="Comic Sans MS";
const ENUM_BASE_CORNER Corner=CORNER_LEFT_LOWER;
const double angle=0.0;
const ENUM_ANCHOR_POINT anchor=ANCHOR_LEFT_LOWER;
const bool back=false;
const bool selection=false;
const bool hidden=true;
const long z_order=0;
double Old_Price;
int OnInit()
{
IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
IndicatorSetString(INDICATOR_SHORTNAME,"Magnified_Market_Price");
return( INIT_SUCCEEDED );
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double& high[],
const double& low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[]
)
{
double Bid = SymbolInfoDouble(Symbol(),SYMBOL_BID);
//---
if (Bid_Ask_Colors==true)
{
if (Bid > Old_Price) FontColor=clrLawnGreen;
if (Bid < Old_Price) FontColor=clrRed;
Old_Price=Bid;
}
string Market_Price=DoubleToString(Bid, _Digits);
//----
ObjectCreate(0,"Market_Price_Label", OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_XDISTANCE,1);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_YDISTANCE,1);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_CORNER,Corner);
ObjectSetString(0,"Market_Price_Label",OBJPROP_TEXT,Market_Price);
ObjectSetString(0,"Market_Price_Label",OBJPROP_FONT,FontType);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_FONTSIZE,FontSize);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_COLOR,FontColor);
ObjectSetDouble(0,"Market_Price_Label",OBJPROP_ANGLE,angle);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_ANCHOR,anchor);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_BACK,back);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_SELECTABLE,selection);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_SELECTED,selection);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_HIDDEN,hidden);
ObjectSetInteger(0,"Market_Price_Label",OBJPROP_ZORDER,z_order);
return(rates_total);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
ObjectDelete(0,"Market_Price_Label");
}
Visual Studio 2017(VS2017) 企业版 Enterprise 注册码:NJVYC-BMHX2-G77MM-4XJMR-6Q8QF
Visual Studio 2017(VS2017) 专业版Professional 激活码key:KBJFW-NXHK6-W4WJM-CRMQB-G3CDH