- 分享
- 0
- 人气
- 0
- 主题
- 102
- 帖子
- 3711
- UID
- 135433
- 积分
- 6230
- 阅读权限
- 23
- 注册时间
- 2008-4-9
- 最后登录
- 2017-2-8
- 在线时间
- 4911 小时
|
- #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);
- }
复制代码 没办法循环
是不是哪里弄错了? |
|