17评论

0收藏

请求帮助

avatar tpdx8888 | 1817 人阅读 | 17 人评论 | 2020-01-05

麻烦问下我的bias指标只有刚设置的时候会执行,但是到下一个k线形成后就不会更新新的bias指标了,我是个菜鸟,不过也试过很多办法都不行,请问这是为什么,请不吝赐教下,万分感谢!

#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_separate_window//
#property indicator_buffers 3//
#property indicator_plots   3
//--- plot fast
#property indicator_label1  "fast"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrBlanchedAlmond
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- plot medium
#property indicator_label2  "medium"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrYellow
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1
//--- plot slow
#property indicator_label3  "slow"
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrFuchsia
#property indicator_style3  STYLE_SOLID
#property indicator_width3  1

//--- input parameters
input int      day1st=34;
input int      day2nd=55;
input int      day3rd=89;
//--- indicator buffers

double         fastBuffer[];
double         mediumBuffer[];
double         slowBuffer[];//

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0,fastBuffer);
   SetIndexBuffer(1,mediumBuffer);
   SetIndexBuffer(2,slowBuffer);

   return(INIT_SUCCEEDED);
  }

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[])
  {

if(rates_total<day1st || rates_total<day2nd || rates_total<day3rd)   
  {
      return(0);
    }

  int i=0;
  int limit;
  limit=rates_total-prev_calculated;
  if(prev_calculated>0)limit++;
  //double Ask;
// double Bid;
  //if(iOpen(NULL,0,0)==Ask || iOpen(NULL,0,0)==Bid)      

  for(i=0;i<=limit;i++)
    {
      
       fastBuffer= 100*(Close- iMA(NULL,0,day1st,0,MODE_SMA,PRICE_CLOSE,i))/iMA(NULL,0,day1st,0,MODE_SMA,PRICE_CLOSE,i);
       mediumBuffer= 100*(Close- iMA(NULL,0,day2nd,0,MODE_SMA,PRICE_CLOSE,i))/iMA(NULL,0,day2nd,0,MODE_SMA,PRICE_CLOSE,i);
       slowBuffer= 100*(Close- iMA(NULL,0,day3rd,0,MODE_SMA,PRICE_CLOSE,i))/iMA(NULL,0,day3rd,0,MODE_SMA,PRICE_CLOSE,i);
  
     }
   
   return(rates_total);
  }






""
还没有人打赏,支持一下

评论|共 17 个

ncliwei

发表于 2020-4-1 15:26:43 | 显示全部楼层

过来看看的

xiaosixf

发表于 2020-6-15 21:34:18 | 显示全部楼层

前排支持下

街边捡幸福

发表于 2020-7-14 15:04:46 | 显示全部楼层

学习了,不错

169gold

发表于 2020-7-20 21:22:46 | 显示全部楼层

学习了,不错

外汇比赛网

发表于 2020-8-23 21:12:30 | 显示全部楼层

帮你顶下哈!!

繁华落幕

发表于 2020-8-26 22:17:52 | 显示全部楼层

帮你顶下哈!!

爱仕达

发表于 2020-9-3 18:49:36 | 显示全部楼层

学习了,不错

dffjkkuvh

发表于 2020-11-11 15:54:44 | 显示全部楼层

支持下

vagolnta

发表于 2020-11-14 15:34:11 | 显示全部楼层

12下一页
您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则