客服热线:18391752892

自己写的ATR不能实时更新

   日期:2019-01-12     浏览:861    
马上注册,结交更多好友,下载更多资源

您需要 登录 才可以下载或查看,没有帐号?注册 #property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue
#property indicator_color2 Gold
#property indicator_width1 1
#property indicator_width2 2
extern int periods = 14;
double TR[];
double ATR[];
int init()
 {
   IndicatorDigits(Digits+1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,TR);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ATR);
   IndicatorShortName( MyATR
   SetIndexLabel(0, TR
   SetIndexLabel(1, ATR
   return(0);
 }
int start()
 {
   int counted_bars = IndicatorCounted();
   if(counted_bars 0)
     counted_bars--;
   int remanent_bars = Bars - counted_bars;
   int i;
   for(i = 0; i remanent_bars; i++)
     TR[i] = MAX(High[i] - Low[i], High[i] - Close[i + 1], Close[i + 1] - Low[i]);
   for(i = 0; i remanent_bars; i++)
     ATR[i] = iMAonArray(TR,Bars,periods,0,MODE_SMA,i);
   return(0);
 }
double MAX(double x, double y, double z)
{
   if(x y) x = y;
   if(x z) x = z;
   return(x);
}
有两个问题:
1. 指标只能在加载的时候执行一次,不能随新K线的出现一起更新。
2. 图表上只有波幅TR,没有均线ATR[]。
请问该怎么修改?

外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!


特别提示:本信息由相关企业自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


0相关评论
相关行情快递
推荐行情快递
点击排行