MT5:放大市場價格指標

  指標把當前交易品種價格簡單的放大顯示圖表
 

//+------------------------------------------------------------------+
//|                                       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);
  }
//+------------------------------------------------------------------+git

void OnDeinit(const int reason)
  {
   ObjectDelete(0,"Market_Price_Label");
  }spa

 

Visual Studio 2017(VS2017) 企業版 Enterprise 註冊碼:NJVYC-BMHX2-G77MM-4XJMR-6Q8QFblog

 

Visual Studio 2017(VS2017)  專業版Professional 激活碼key:KBJFW-NXHK6-W4WJM-CRMQB-G3CDHstring

相關文章
相關標籤/搜索