[MT4指标]Bears区间指标
主图指标
附图指标,
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
mt4指标类型:震荡指标
是否能用在mt4手机版上:否
是否含有未来函数:无
可以用在韬客外汇返佣网的平台上
//+------------------------------------------------------------------+
//| Bears.mq4 |
//| Copyright ? 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Teo_Onica"
#property link "phone:0612480123"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LawnGreen
#property indicator_color2 Blue
#property indicator_color3 Orange
//---- input parameters
extern int per=1000;
extern double BandsDeviations=0.5;
//extern int signal=5;
//extern int main=3;
//---- buffers
double regr;
double regrh;
double regrb;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(3);
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
//---- indicator buffers mapping
SetIndexBuffer(0,regr);
SetIndexStyle(1,DRAW_LINE);
//---- indicator buffers mapping
SetIndexBuffer(1,regrh);
//ObjectCreate("Rezist", OBJ_TREND, 0,0,0,0,0);
SetIndexStyle(2,DRAW_LINE);
//---- indicator buffers mapping
SetIndexBuffer(2,regrb);
return(0);
}
int deinit()
{
//ObjectDelete("Rezist");
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Bears Power |
//+------------------------------------------------------------------+
int start()
{
double x,y,etapc,xy,etapd,xx,etapf,yy,coefa,coefb,naw,nawb,rac,cor,temp,tempp,sum,deviation,deviationtemp;
int i,a,b,c,k,counted_bars=IndicatorCounted();
//----
//if(Bars<=BearsPeriod) return(0);
//----
// int limit=Bars-counted_bars;
// if(counted_bars>0) limit++;
//for(i=0; i=0)
{
x=x+i;
y=y+Close;
etapc=Close*i;
xy=xy+etapc;
etapd=i*i;
xx=xx+etapd;
etapf=Close*Close;
yy=yy+etapf;
i--;
}
coefb=((per*xy)-(x*y))/((per*xx)-(x*x));
coefa=(y-(coefb*x))/per;
//vala=coefa+(coefb*1);
//valb=coefa+(coefb*per);
naw=((per*xx)-(x*x))*((per*yy)-(y*y));
nawb= MathAbs(naw);
rac=MathSqrt(nawb);
cor=((per*xy)-(x*y))/rac;
int haut =iHighest(NULL,0,MODE_HIGH,per,1);
int bas =iLowest(NULL,0,MODE_LOW,per,1);
while(a>=0)
{
regr[a]=coefa+(coefb*a);
a--;
}
//ObjectSet("Rezist", OBJPROP_TIME1 ,Time[per]);
//ObjectSet("Rezist", OBJPROP_TIME2 ,Time[1]);
//ObjectSet("Rezist", OBJPROP_TIME3 ,Time[1]);
//ObjectSet("Rezist", OBJPROP_PRICE1,valb);
//ObjectSet("Rezist", OBJPROP_PRICE2,vala);
//ObjectSet("Rezist", OBJPROP_PRICE3,valc);
//ObjectSet("Rezist", OBJPROP_RAY , True);
// double priceh = ObjectGetValueByShift("Rezist", haut);
//double priceb = ObjectGetValueByShift("Rezist", bas);
//Comment("haut ",hh," bas ",bb," correlation ",cor," ym ",ym);
//----
i=0;
sum=0.0;
k=i+per-1;
temp=regr;
while(k>=i)
{
tempp=Close[k]-temp;
sum+=tempp*tempp;
k--;
}
deviation=BandsDeviations*MathSqrt(sum/per);
i=per;
while(i>=0)
{
temp=regr;
regrh=temp+deviation;
regrb=temp-deviation;
i--;
}
//----
//----
return(0);
}
//+------------------------------------------------------------------+
lineaire.jpg

发表于:2015-08-03 01:17只看该作者
2楼
沙发,看看先。
韬客社区www.talkfx.co