- 精华
- 0
- 在线时间
- 466 小时
- UID
- 110420
- 积分
- 547
- 帖子
- 326
- 阅读权限
- 50
- 注册时间
- 2012-5-11
- 最后登录
- 2019-1-11
- 精华
- 0
- UID
- 110420
- 积分
- 547
- 帖子
- 326
- 主题
- 16
- 阅读权限
- 50
- 注册时间
- 2012-5-11
- 最后登录
- 2019-1-11
|
本帖最后由 受伤的小鱼 于 2013-3-7 16:01 编辑
受伤的小鱼 发表于 2013-3-7 15:33
马虎拟合个200来凑个数吧
Numeric NB(4);
Numeric ATRLEN(18);
Vars
Numeric offs;
Numeric i;
Numeric ls;
Numeric lsv(0);
NumericSeries ATR;
NumericSeries atrvol;
NumericSeries XTRvol;
BoolSeries atru;
BoolSeries atrd;
NumericSeries LPOW;
NumericSeries SPOW;
Numeric atrstl;
Numeric atrsts;
Numeric sthh;
Numeric stll;
Numeric hlp;
Numeric lsp;
Begin
offs=MinMove*PriceScale;
atrvol=Average(vol,ATRLEN);
xtrvol=Average(atrvol,XTRLEN);
atru=atrvol[1]大于xtrvol[1] and atrvol[2]大于xtrvol[2];
atrd=atrvol[1]小于xtrvol[1] and atrvol[2]小于xtrvol[2];
atr=Average((h-l),ATRLEN);
if (atru) {atrstl=open-atrstlvu*atr[1];atrsts=open+atrstsvu*atr[1];}
if (atrd) {atrstl=open-atrstlvd*atr[1];atrsts=open+atrstsvd*atr[1];}
IF (ATRU双=FALSE AND ATRD双=FALSE) {ATRSTL=OPEN-ATRSTLVM*ATR[1];ATRSTS=OPEN+ATRSTSVm*ATR[1];}
for i=1 to nb
{
IF (O[I]大于c[I]) LS=-1;
IF (O[I]小于C[I]) LS=1;
LSv=LSV+LS;
}
IF (LSV双=0-nb)
{
if (atru) SellShort(0,OPEN-offs);
//if (atru双=false) Sell(0,open-offs);
}
if (LSV 双=nb)
{
if (atru) Buy(0,OPEN+offs);
//IF (ATRU双=FALSE) BuyToCover(OPEN+OFFS);
}
hlp=HighestBar(close[1],barssinceentry+1);
lsp=lowestbar(close[1],barssinceentry+1);
if (MarketPosition大于0 and hlp大于sllen )
{sell(0,open-MinMove*PriceScale);}
if (MarketPosition小于0 and lsp大于sslen )
{BuyToCover(0,open+MinMove*PriceScale);}
if (barssinceentry大于stllen and marketposition双=1 and open小于lastentryprice ) sell(0,open+offs);
if (barssinceentry大于stslen and marketposition双=-1 and open大于lastentryprice) BuyToCover(0,open+offs);
if (marketposition双= 1 and low 小于atrstl ) Sell(0,atrstl-2*offs);
if (marketposition双=-1 and high大于atrsts ) BuyToCover(0,atrsts+2*offs);
End
TNND,说什么含有非法参数,害得老子改了半天才弄好! |
|