Params
numeric lots(1);
numeric save(20);
numeric holdpoint(0.3);//震荡系数在hold之下的时候判定为震荡才开仓
Vars
Series<Numeric> upline;
Series<Numeric> downline;
Series<Numeric> midline;
Series<Numeric> upline_ ;//中间线
Series<Numeric> downline_; //中间线
Series <Numeric> band;
Series<Bool> con1;
Series<Bool> con2;
Series<Numeric> minpoint;
Series<Numeric> avgvlue1;
Series<Numeric> avgvlue2;
Series<Numeric> hold;
Events
OnBar(ArrayRef<integer>indexs)
{
midline = AverageFC(close, 26);
band = StandardDev(close, 26,2);
upline = midline + 2*band;
downline =midline -2*band;
PlotNumeric("upline" ,highest(upline ,3));
PlotNumeric("downline", lowest(downline,3));
upline_ =Highest(upline,3);
downline_ =lowest(downline,3);
//过滤掉波动大的行情
avgvlue1=AverageFC(close,30);
avgvlue2=AverageFC(close, 60);
hold=Abs(avgvlue1 - avgvlue2)/Close*100;
//开仓条件判断
con1=Close[1]<downline_ [1] And close >downline_ And Close>Open;
con2=close[1>upline_ [1] and Close <upline_ and close <Open;
If(MarketPosition<>1 And con1[1] And hold[1]<=holdpoint) //避免未来函数
{
Buy(lots,Open);
Commentary(“多单进场");
}
If(MarketPosition <> -1 And con2[1]And hold[1]<=holdpoin) //避免未来函数
{
SellShort(lots, Open);
Commentary(“空单进场");
}
If(MarkolPosition ==1 and Close[1]<AvgEntyPrice-save*minpoint And BarsSinceEntry>0)
{
Sell(lots, Open);
Commentary("多单止损出场");
}
If(MarketPosition==-1 And Close[1]>AvgEntryPrice + save*minpoint And BarsSinceEntry>0)
{
BuyToCover(lots, Open);
Commentary("空单止损出场");
}
If(MarketPosition==1 and high[1]>=upline)
{
sell(0,Open);
Commentary("多单出现止盈");
}
lf(MarketPosition==-1 and lowM[1]<=downline)
{
BuyToCover(0,Open);
Commentary("空单出现止盈");
}//多单固定止盈
If(MarketPosition==1 And Close[1]>AvgEntryPrice+save*minpoint*1.2 and BarsSinceEntry>0)
{
sell(0, Open);
Commentary(“多单止盈出场”)
}
lf(MarketPosition=-1 And Close[1]<AvgEntryPrice -save*minpoint*1.2 and BarsSinceEntry>0)
{
BuyToCover(0,Open);
Commentary("空单止盈出场");
}
If(MarketPosition==1 And hold[1]>0.4 and BarsSinceEntry>0 and close[1]<AvgEntryPrice)
{
sell(lots,Open);
Commentary"波动过大,目前亏损状态出场”);
}
If(MarketPosition==-1 And hold[1]>0.4 and BarsSinceEntry>0 and cose[1]>AvgEntyPrice)
{
BuyToCover(lots ,Open);
Commentary("波动过大,目前亏损状态出场”);
}
}
Params
numeric lots(1);
numeric save(20);
numeric holdpoint(0.3);//震荡系数在hold之下的时候判定为震荡才开仓
Vars
Series<Numeric> upline;
Series<Numeric> downline;
Series<Numeric> midline;
Series<Numeric> upline_ ;//中间线
Series<Numeric> downline_; //中间线
Series <Numeric> band;
Series<Bool> con1;
Series<Bool> con2;
Series<Numeric> minpoint;
Series<Numeric> avgvlue1;
Series<Numeric> avgvlue2;
Series<Numeric> hold;
Events
OnBar(ArrayRef<integer>indexs)
{
midline = AverageFC(close, 26);
band = StandardDev(close, 26,2);
upline = midline + 2*band;
downline =midline -2*band;
PlotNumeric("upline" ,highest(upline ,3));
PlotNumeric("downline", lowest(downline,3));
upline_ =Highest(upline,3);
downline_ =lowest(downline,3);
//过滤掉波动大的行情
avgvlue1=AverageFC(close,30);
avgvlue2=AverageFC(close, 60);
hold=Abs(avgvlue1 - avgvlue2)/Close*100;
//开仓条件判断
con1=Close[1]<downline_[1] And close >downline_ And Close>Open;
con2=close[1]>upline_[1] and Close <upline_ and close <Open;
If(MarketPosition<>1 And con1[1] And hold[1]<=holdpoint) //避免未来函数
{
Buy(lots,Open);
Commentary("多单进场");
}
If(MarketPosition <> -1 And con2[1]And hold[1]<holdpoint) //避免未来函数
{
SellShort(lots, Open);
Commentary("空单进场");
}
If(MarketPosition ==1 and Close[1]<AvgEntryPrice-save*minpoint And BarsSinceEntry>0)
{
Sell(lots, Open);
Commentary("多单止损出场");
}
If(MarketPosition==-1 And Close[1]>AvgEntryPrice + save*minpoint And BarsSinceEntry>0)
{
BuyToCover(lots, Open);
Commentary("空单止损出场");
}
If(MarketPosition==1 and high[1]>=upline)
{
sell(0,Open);
Commentary("多单出现止盈");
}
if(MarketPosition==-1 and low[1]<=downline)
{
BuyToCover(0,Open);
Commentary("空单出现止盈");
}//多单固定止盈
If(MarketPosition==1 And Close[1]>AvgEntryPrice+save*minpoint*1.2 and BarsSinceEntry>0)
{
sell(0, Open);
Commentary("多单止盈出场");
}
if(MarketPosition==-1 And Close[1]<AvgEntryPrice -save*minpoint*1.2 and BarsSinceEntry>0)
{
BuyToCover(0,Open);
Commentary("空单止盈出场");
}
If(MarketPosition==1 And hold[1]>0.4 and BarsSinceEntry>0 and close[1]<AvgEntryPrice)
{
sell(lots,Open);
Commentary("波动过大,目前亏损状态出场");
}
If(MarketPosition==-1 And hold[1]>0.4 and BarsSinceEntry>0 and close[1]>AvgEntryPrice)
{
BuyToCover(lots ,Open);
Commentary("波动过大,目前亏损状态出场");
}
}
//close写成cose
//low写成lowm
//avgentryprice写成avgentyprice
//大量符号写成全角模式
//感觉就像从哪里要来一份策略代码,自己手动输入一遍,然后错了一大堆细节
//读代码是好的学习习惯,但是也要学会自己检查编译错误,这种事基础得不能再基础的技能了
这是动态突破策略。你整出来,也是低胜率低盈亏比的东东
加我我QQ356247161 聊
理性交往,这个人很容易发火而且喜欢呼唤狐朋狗友上门堵人
中英文切换,单词拼写
哪里找来的程序,都是一些拼写错误,标点符号问题
Params
numeric lots(1);
numeric save(20);
numeric holdpoint(0.3);//震荡系数在hold之下的时候判定为震荡才开仓
Vars
Series<Numeric> upline;
Series<Numeric> downline;
Series<Numeric> midline;
Series<Numeric> upline_ ;//中间线
Series<Numeric> downline_; //中间线
Series <Numeric> band;
Series<Bool> con1;
Series<Bool> con2;
Series<Numeric> minpoint;
Series<Numeric> avgvlue1;
Series<Numeric> avgvlue2;
Series<Numeric> hold;
Events
OnBar(ArrayRef<integer>indexs)
{
midline = AverageFC(close, 26);
band = StandardDev(close, 26,2);
upline = midline + 2*band;
downline =midline -2*band;
PlotNumeric("upline" ,highest(upline ,3));
PlotNumeric("downline", lowest(downline,3));
upline_ =Highest(upline,3);
downline_ =lowest(downline,3);
//过滤掉波动大的行情
avgvlue1=AverageFC(close,30);
avgvlue2=AverageFC(close, 60);
hold=Abs(avgvlue1 - avgvlue2)/Close*100;
//开仓条件判断
con1=Close[1]<downline_ [1] And close >downline_ And Close>Open;
con2=close[1]>upline_ [1] and Close <upline_ and close <Open;
If(MarketPosition<>1 And con1[1] And hold[1]<=holdpoint) //避免未来函数
{
Buy(lots,Open);
Commentary("多单进场");
}
If(MarketPosition <> -1 And con2[1]And hold[1]<=holdpoint) //避免未来函数
{
SellShort(lots, Open);
Commentary("空单进场");
}
If(MarketPosition ==1 and Close[1]<AvgEntryPrice -save*minpoint And BarsSinceEntry>0)
{
Sell(lots, Open);
Commentary("多单止损出场");
}
If(MarketPosition==-1 And Close[1]>AvgEntryPrice + save*minpoint And BarsSinceEntry>0)
{
BuyToCover(lots, Open);
Commentary("空单止损出场");
}
If(MarketPosition==1 and high[1]>=upline)
{
sell(0,Open);
Commentary("多单出现止盈");
}
if(MarketPosition==-1 and low[1]<=downline)
{
BuyToCover(0,Open);
Commentary("空单出现止盈");
}
//多单固定止盈
If(MarketPosition==1 And Close[1]>(AvgEntryPrice+save*minpoint*1.2) and BarsSinceEntry>0)
{
sell(0, Open);
Commentary("多单止盈出场");
}
if(MarketPosition<0 And Close[1]<(AvgEntryPrice -save*minpoint*1.2) and BarsSinceEntry>0)
{
BuyToCover(0,Open);
Commentary("空单止盈出场");
}
If(MarketPosition==1 And hold[1]>0.4 and BarsSinceEntry>0 and close[1]<AvgEntryPrice)
{
sell(lots,Open);
Commentary("波动过大,目前亏损状态出场");
}
If(MarketPosition==-1 And hold[1]>0.4 and BarsSinceEntry>0 and close[1]>AvgEntryPrice)
{
BuyToCover(lots,Open);
Commentary("波动过大,目前亏损状态出场");
}
}
网页上代码怎么不好复制,我的还是编译错误。我的Q356247161