等级: 免费版
- 注册:
- 2021-10-13
- 曾用名:
|
请金融工程师修改成金字塔可以用的语言,感谢!策略源码(Multicharts版本):
inputs:sb(6);
variables:var0(0),var1(0),var2(0),var3(0),var4(0);
var0=Average(close,21);
var1=Average(close,55);
var2=Average(close,120);
var3=BollingerBand(close,21,2);
var4=BollingerBand(close,21,-2);
condition1=var0>var1 and var1>var2 and close>var0;
condition2=var0<var1 and var1<var2 and close<var0;
condition3=var3-var4<var3[1]-var4[1];
if condition1 and condition3 then buy next bar at market;
if condition2 and condition3 then sellshort next bar at market;
sell next bar at var4+sb*(var3[1]-var4[1]) limit;
buytocover next bar at var4-sb*(var3[1]-var4[1]) limit;
sell next bar at var2[1] stop;
If BarsSinceEntry(0)>21 then Sell Next Bar at var1[1] stop;
If BarsSinceEntry(0)>55 then Sell Next Bar at var0[1] stop;
buytocover next bar at var2[1] stop;
If BarsSinceEntry(0)>21 then BuytoCover Next Bar at var1[1] stop;
If BarsSinceEntry(0)>55 then BuytoCover Next Bar at var0[1] stop;
|
|