博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MT5:放大市场价格指标
阅读量:5077 次
发布时间:2019-06-12

本文共 3213 字,大约阅读时间需要 10 分钟。

  指标把当前交易品种价格简单的放大显示图表
 

//+------------------------------------------------------------------+

//|                                       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

转载于:https://www.cnblogs.com/fang8206/p/5880542.html

你可能感兴趣的文章
左手坐标系和右手坐标系
查看>>
solr后台操作Documents之增删改查
查看>>
http://yusi123.com/
查看>>
文件文本的操作
查看>>
Ubuntu linux下gcc版本切换
查看>>
记一次Web服务的性能调优
查看>>
Linux常用命令大全
查看>>
jQuery.form.js使用
查看>>
(转)linux sort,uniq,cut,wc命令详解
查看>>
关于ExecuteNonQuery执行的返回值(SQL语句、存储过程)
查看>>
UVa540 Team Queue(队列queue)
查看>>
mysql数据增删改查
查看>>
shell中下载最新版本或指定版本的办法(Dockerfile 中通用)
查看>>
极客时间-左耳听风-程序员攻略-分布式架构工程设计
查看>>
akka之种子节点
查看>>
不知道做什么时
查看>>
matlab 给某一列乘上一个系数
查看>>
密码学笔记——培根密码
查看>>
Screening technology proved cost effective deal
查看>>
MAC 上升级python为最新版本
查看>>