适合懒人、不用盯盘
MQL5和C是类似的
//+------------------------------------------------------------------+
//| junxianyujing.mq5 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 4 //定义4个画线位置
#property indicator_plots 4 //画4条线
//---- plot long
#property indicator_label1 "long" //这条线的名称
#property indicator_type1 DRAW_LINE //这条线的类型是线性
#property indicator_color1 Red //这条线的颜色
#property indicator_style1 STYLE_SOLID //这条线是实线
#property indicator_width1 1 //这条线的宽度是1
//---- plot small
#property indicator_label2 "small"
#property indicator_type2 DRAW_LINE
#property indicator_color2 Yellow
#property indicator_style2 STYLE_SOLID
#property indicator_width2 1
//---- plot up
#property indicator_label3 "up"
#property indicator_type3 DRAW_ARROW //这里我们要画箭头
#property indicator_color3 White
#property indicator_style3 STYLE_SOLID
#property indicator_width3 1
//---- plot down
#property indicator_label4 "down"
#property indicator_type4 DRAW_ARROW
#property indicator_color4 MediumBlue
#property indicator_style4 STYLE_SOLID
#property indicator_width4 1
//--- input parameters
input int longma=50; //长均线周期(也就是上面图中我们输入的)
input int smallma=10; //短均线周期(也就是上面图中我们输入的)
//--- indicator buffers
double longBuffer[]; //(也就是上面图中我们输入的画线是long的时候,这里就会产生一个longBuffer[]数组)
double