本帖最后由 sanqiandd 于 2021-2-6 22:29 编辑
- #property copyright "Copyright 2019, MetaQuotes Software Corp."
- #property link "https://www.mql5.com"
- #property version "1.00"
- #property strict
- #property indicator_chart_window
- #property indicator_buffers 10
- #property indicator_color1 clrNONE
- #property indicator_color2 clrNONE
- #property indicator_color3 clrNONE
- #property indicator_color4 clrRed
- #property indicator_width4 1
- #property indicator_color5 clrRed
- #property indicator_width5 1
- #property indicator_color6 clrLime
- #property indicator_width6 1
- #property indicator_color7 clrLime
- #property indicator_width7 1
- #define FONT_NAME "Microsoft YaHei"
- bool upexist_fanbao=0;
- bool downexist_fanbao=0;
- int timeup_fanbao,t_fanbao=0,timedown_fanbao;
- string period_fanbao="";
- int kxianshu_fanbao=34;//K线数
- extern int juli_fanbao=20;//箭头距离
- double linshi_fanbao[]/*原数量1200*/,ave_fanbao[]/*原数量1200*/,zhenfu_fanbao[],sum_fanbao=0;
- double up_fanbao[]/*原数量1200*/,upopen_fanbao,upzancun_fanbao[]/*原数量1200*/;
- double down_fanbao[]/*原数量1200*/,downopen_fanbao,downzancun_fanbao[]/*原数量1200*/;
- double upxiao_fanbao[]/*原数量1200*/,yangxianzancun_fanbao,yangxian_fanbao,duozuigao_fanbao;
- string up2_fanbao="",down2_fanbao="";
- double upda_fanbao[]/*原数量1200*/;
- double downxiao_fanbao[]/*原数量1200*/,yinxianzancun_fanbao,yinxian_fanbao,kongzuidi_fanbao;
- double downda_fanbao[]/*原数量1200*/,junzhi_fanbao[]/*原数量1200*/;
- double duolot_fanbao,konglot_fanbao,duosun_fanbao,kongsun_fanbao,rineikongjian_fanbao;
- int tup_fanbao,tdown_fanbao,emazhouqi_fanbao,bulinxiabao_fanbao,bulinshangbao_fanbao;
- color clrup_fanbao=clrAqua,clrdown_fanbao=clrAqua;
- double zhenshiprice_fanbao,yijiaprice_fanbao;
- double duokaipan_fanbao,kongkaipan_fanbao,duosunlinshi_fanbao,kongsunlinshi_fanbao,duoshoulinshi_fanbao,kongshoulinshi_fanbao;
- int OnInit()
- {
- IndicatorDigits(Digits);
- SetIndexBuffer(0,zhenfu_fanbao);
- SetIndexBuffer(1,up_fanbao);
- SetIndexStyle(1,DRAW_NONE);
- SetIndexLabel(1,"up_fanbao");
- SetIndexBuffer(2,down_fanbao);
- SetIndexStyle(2,DRAW_NONE);
- SetIndexLabel(2,"down_fanbao");
- SetIndexBuffer(3,upxiao_fanbao);
- SetIndexStyle(3,DRAW_ARROW);
- SetIndexLabel(3,"upxiao_fanbao");
- SetIndexArrow(3,241);
- SetIndexBuffer(4,upda_fanbao);
- SetIndexStyle(4,DRAW_ARROW);
- SetIndexLabel(4,"upda_fanbao");
- SetIndexArrow(4,233);
- SetIndexBuffer(5,downxiao_fanbao);
- SetIndexStyle(5,DRAW_ARROW);
- SetIndexLabel(5,"downxiao_fanbao");
- SetIndexArrow(5,242);
- SetIndexBuffer(6,downda_fanbao);
- SetIndexStyle(6,DRAW_ARROW);
- SetIndexLabel(6,"downda_fanbao");
- SetIndexArrow(6,234);
- SetIndexBuffer(7,upzancun_fanbao);
- SetIndexStyle(7,DRAW_NONE);
- SetIndexLabel(7,"upzancun_fanbao");
- SetIndexBuffer(8,downzancun_fanbao);
- SetIndexStyle(8,DRAW_ARROW);
- SetIndexLabel(8,"downzancun_fanbao");
- SetIndexBuffer(9,junzhi_fanbao);
- SetIndexStyle(9,DRAW_LINE,0,1,clrNONE);
- SetIndexLabel(9,"junzhi_fanbao");
- IndicatorShortName("fanbao("+Symbol()+Period()+")");
- ArrayInitialize(upzancun_fanbao,0);
- ArrayInitialize(downzancun_fanbao,0);
- if(Period()==1) {period_fanbao="M1";}
- if(Period()==5) {period_fanbao="M5";emazhouqi_fanbao=1;}
- if(Period()==15) {period_fanbao="M15";emazhouqi_fanbao=5;}
- if(Period()==30) {period_fanbao="M30";}
- if(Period()==60) {period_fanbao="H1";emazhouqi_fanbao=15;}
- if(Period()==240) {period_fanbao="H4";emazhouqi_fanbao=60;}
- if(Period()==1440) {period_fanbao="D1";emazhouqi_fanbao=240;}
- if(Period()==10080) {period_fanbao="W1";emazhouqi_fanbao=1440;}
- if(Period()==43200) {period_fanbao="MN1";emazhouqi_fanbao=10080;}
- if(Symbol()=="XTIUSD") juli_fanbao=2;
- return(INIT_SUCCEEDED);
- }
复制代码 指标编写过程中没报警,MT4插入指标报警。私我或留言,发你源码 |