int chart_id = 0; string line_name = TimeToString(D'2021.04.01 00:00:00'); if(!ObjectCreate(chart_id,line_name,OBJ_VLINE,0,D'2021.04.01 00:00:00',0)) { printf(": failed to create a line! Error code = ",GetLastError()); } //设置属性 ObjectSetInteger(chart_id,line_name,OBJPROP_COLOR,line_color); //设置颜色 ObjectSetInteger(chart_id,line_name,OBJPROP_STYLE,line_style); //设置风格 ObjectSetInteger(chart_id,line_name,OBJPROP_WIDTH,line_width); //设置宽度
datetime time_lines[]; ENUM_TIMEFRAMES time_period = PERIOD_H1; datetime time_start = D'2021.01.01 00:00:00'; datetime time_end = D'2021.04.21 00:00:00'; CopyTime(Symbol(),time_period,time_start,time_end,time_lines);
MqlDateTime time_struct ; TimeToStruct(time_lines[i],time_struct); if(time_struct.hour == 0 && time_struct.min == 0 && time_struct.sec == 0) { //画线对象 }
input datetime time_start = D'2021.01.01 00:00:00'; input datetime time_end = D'2021.04.21 00:00:00'; input ENUM_TIMEFRAMES time_period = PERIOD_H1; input color line_color = clrRed; input ENUM_LINE_STYLE line_style = STYLE_SOLID; input int line_width = 2;
//+------------------------------------------------------------------+ //| sign by price.mq5 | //| wx=> wentxiong | //| http://www.popoding.club/ | //+------------------------------------------------------------------+ #property copyright "Wen Tao Xiong" #property link "/zh/users/xiongsir/seller" #property version "1.00" #property script_show_inputs input color line_clr = clrBlue; input ENUM_LINE_STYLE line_style = STYLE_SOLID; input int line_width = 3; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- double price_max = 2.00000; double price_min = 1.00000; double price_int[]; ArrayResize(price_int,300); double price_tmp = price_min; int m = 0; for(m = 0 ; price_tmp <= price_max ; m++) { price_int[m] = price_tmp; price_tmp = price_tmp + 0.00500; } ArrayRemove(price_int,m); for(int i = 0 ; i < ArraySize(price_int); i++) { string line_name = DoubleToString(price_int[i]); if(!ObjectCreate(0,line_name,OBJ_HLINE,0,0,price_int[i])) { printf("draw a line error :d%", GetLastError()); } ObjectSetInteger(0,line_name,OBJPROP_COLOR,line_clr); 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(突破回踩卖出):在当前位置下方,等待行情下跌到突破位置后, 再上涨到回踩位置,触发卖出单。