//画横线对象 string line_name = DoubleToString(1.20330); if(!ObjectCreate(0,line_name,OBJ_HLINE,0,0,1.20330)) { printf(": failed to create a line! Error code = ",GetLastError()); } ObjectSetInteger(0,line_name,OBJPROP_COLOR,clrRed); //设置颜色 ObjectSetInteger(0,line_name,OBJPROP_STYLE,STYLE_SOLID); //设置风格 ObjectSetInteger(0,line_name,OBJPROP_WIDTH,1); //设置宽度
//整点价格位置 double price_max = 2.00000; double price_min = 1.00000; double price_integer[]; ArrayResize(price_integer,300); double price_tmp = price_min; int m = 0; for(m = 0; price_tmp <= price_max; m++) { price_integer[m] = price_tmp; price_tmp = price_tmp + 0.00500; } ArrayRemove(price_integer,m); for(int i = 0; i < ArraySize(price_integer); i++) { //画横线对象 }
input color line_color = clrRed; input ENUM_LINE_STYLE line_style = STYLE_SOLID; input int line_width = 2;
#property copyright "公众号 Luyuanmw 微信 wentxiong" #property link "http://www.popoding.club/" #property version "1.00" #property script_show_inputs input color line_color = clrRed; input ENUM_LINE_STYLE line_style = STYLE_SOLID; input int line_width = 2; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- //整点价格位置 double price_max = 2.00000; double price_min = 1.00000; double price_integer[]; ArrayResize(price_integer,300); double price_tmp = price_min; int m = 0; for(m = 0; price_tmp <= price_max; m++) { price_integer[m] = price_tmp; price_tmp = price_tmp + 0.00500; } ArrayRemove(price_integer,m); for(int i = 0; i < ArraySize(price_integer); i++) { //画横线对象 string line_name = DoubleToString(price_integer[i]); if(!ObjectCreate(0,line_name,OBJ_HLINE,0,0,price_integer[i])) { printf(": failed to create a line! Error code = ",GetLastError()); } ObjectSetInteger(0,line_name,OBJPROP_COLOR,line_color); //设置颜色 ObjectSetInteger(0,line_name,OBJPROP_STYLE,line_style); //设置风格 ObjectSetInteger(0,line_name,OBJPROP_WIDTH,line_width); //设置宽度 } }
六类挂单一键取消脚本
MT5挂单类型有六种,能够很好地适应回调和突破场景,在一些突破策略交易系统中应用较多,当挂单条件不再有效的时候,就会涉及到挂单的取消操作。六种挂单应用说明如下: Buy Limit(回踩买入):在当前价格下方,等待行情下跌到挂单位置触发买入单。 Sell Limit(回踩卖出):在当前价格上方,等待行情上涨到挂单位置触发卖出单。 Buy Stop(突破买入):在当前价格上方,等待行情上涨到挂单位置触发买入单。 Buy Stop(突破卖出):在当前价格下方,等待行情下跌到挂单位置触发卖出单。 Buy Stop Limit(突破回踩买入):在当前价格上方,等待行情上涨到突破位置后,再下跌到回踩位置,触发买入单。 Sell Stop Limit(突破回踩卖出):在当前位置下方,等待行情下跌到突破位置后, 再上涨到回踩位置,触发卖出单。
双线一柱变色MACD指标
MT5已经自带了很多指标,给交易带来了极大便利,作为辅助工具,很多时候我们需要对其进行进一步改造,或重新自定义指标,本例通过实现双线一柱变色MACD指标来进行说明。
按时间标记位置脚本
无论是进行策略分析,还是进行交易系统设计,时间是一个非常重要的参照因素,特别是在进行历史数据回溯验证的时候,如果想快速定位到某个时间点,就需要找到一个办法在行情图表上进行明显的标记,比如在什么时间点出现了亏损、什么时间点出现了盈利,使用按时间标记功能,就可以快速标记所有位置,便于统计、分析。在这个例子中,我们运用的是画竖线的方式,并区分不同颜色的线,来实现需求。
mt5剩余时间的指标
这是mt4 转 mt5的 剩余时间的指标,分享大家