请版主帮忙看看,到底哪里出错了(已解决)
目的:在系统bands的基础上,再输出一条线,价格上触布林上线输出1,下触布林线下线输出2。没想明白错在哪个地方,请帮忙指点。//+------------------------------------------------------------------+
//| Bands.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| //+------------------------------------------------------------------+
#property copyright \"Copyright ?2005, MetaQuotes Software Corp.\"
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 LightSeaGreen
#property indicator_color2 LightSeaGreen
#property indicator_color3 LightSeaGreen
#property indicator_color4 LightSeaGreen
//---- indicator parameters
extern int BandsPeriod=20;
extern int BandsShift=0;
extern double BandsDeviations=2.0;
int mark=0;
//---- buffers
double MovingBuffer[];
double UpperBuffer[];
double LowerBuffer[];
double out[];
double ll[];
double hh[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,MovingBuffer);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,UpperBuffer);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,LowerBuffer);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,out);
//----
SetIndexDrawBegin(0,BandsPeriod+BandsShift);
SetIndexDrawBegin(1,BandsPeriod+BandsShift);
SetIndexDrawBegin(2,BandsPeriod+BandsShift);
SetIndexDrawBegin(3,BandsPeriod+BandsShift);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Bollinger Bands |
//+------------------------------------------------------------------+
int start()
{
int i,k,counted_bars=IndicatorCounted();
double deviation;
double sum,oldval,newres;
//----
if(Bars=i)
{
newres=Close-oldval;
sum+=newres*newres;
k--;
}
deviation=BandsDeviations*MathSqrt(sum/BandsPeriod);
UpperBuffer<i>=oldval+deviation;
LowerBuffer<i>=oldval-deviation;
ll<i>=iLow(0,0,i);
hh<i>=iHigh(0,0,i);
if(hh<i>>UpperBuffer<i>&&ll<i>>LowerBuffer<i>&&mark!=1){mark=1;}
if(hh<i> 说的不错 shit 鉴定完毕.! 我有一个EA 好坏你自己定免费的需要的话 可以发给你玩玩 不错 不错比我强多了 慢慢来,呵呵 EA水很深 并不是一般人就能玩的了的 打消这个念头吧~~ 看看吧,谢谢分享 nice!!!!!!!!!!!!
页:
[1]
2