JBTALKS.CC
标题:
MQL4 的问题,不能循环,类似C++语言
[打印本页]
作者:
★笨☆天使
时间:
2015-8-15 02:26 PM
标题:
MQL4 的问题,不能循环,类似C++语言
#define SH_BUY 1
#define SH_SELL -1
extern int Otstup=30;
extern double Per=9;
int SH,NB,i,UD;
double R,SHMax,SHMin;
double BufD[];
double BufU[];
int init()
{
if (Bars<AllBars+Per || AllBars==0) NB=Bars-Per; else NB=AllBars;
IndicatorBuffers(2);
IndicatorShortName("SHI_SilverTrendSig");
SetIndexStyle(0,DRAW_ARROW,0,1);
SetIndexStyle(1,DRAW_ARROW,0,1);
SetIndexArrow(0,159);
SetIndexArrow(1,159);
SetIndexBuffer(0,BufU);
SetIndexBuffer(1,BufD);
SetIndexDrawBegin(0,Bars-NB);
SetIndexDrawBegin(1,Bars-NB);
Print("NB:", NB);
return(0);
}
int start()
{
int CB=IndicatorCounted();
if(CB<0) return(-1); else if(NB>Bars-CB) NB=Bars-CB;
for (SH=1;SH<NB;SH++)
{
for (R=0,i=SH;i<SH+10;i++) {R+=(10+SH-i)*(High[i]-Low[i]);} R/=55;
SHMax = High[Highest(NULL,0,MODE_HIGH,Per,SH)];
SHMin = Low[Lowest(NULL,0,MODE_LOW,Per,SH)];
if (Close[SH]<SHMin+(SHMax-SHMin)*Otstup/100 && UD!=SH_SELL) { BufU[SH]=Low[SH]-R*0.5; UD=SH_SELL; }
if (Close[SH]>SHMax-(SHMax-SHMin)*Otstup/100 && UD!=SH_BUY) { BufD[SH]=High[SH]+R*0.5; UD=SH_BUY; }
}
return(0);
}
复制代码
没办法循环
是不是哪里弄错了?
欢迎光临 JBTALKS.CC (https://www.jbtalks.cc/)
Powered by Discuz! X2.5