-- 作者:jinzhe
-- 发布时间:2013/10/16 13:22:26
--
input:x(5,1,100); m:=26; n:=2; MID : MA(CLOSE,M); UPPER: MID + N*STD(CLOSE,M); LOWER: MID - N*STD(CLOSE,M); {布林交易,我想做成突破上轨平空做多。突破下轨平多做空。回到中轨不管!! 要走完一根k线,还保持条件。第二根k线一开始下单!! 条件二是如果突破上下轨x个单位值在当根k线就下单。布林带上中下轨,还有x,都可以调整参数的!! } if ref(cross(h,upper),1) then BEGIN sellshort(1,0,limitr,open); buy(holding=0,1,limitr,open); end
if h>upper+x*mindiff or l<lower-x*mindiff then begin sell(1,0,thisclose); buyshort(holding=0,1,thisclose); end
需要在图表使用1秒轮询的方式,具体参见下图
此主题相关图片如下:1.png

|
-- 作者:jinzhe
-- 发布时间:2013/10/16 16:14:31
--
input:x(5,1,100); input:m(26,1,100); input:n(2,1,100); MID : MA(CLOSE,M); UPPER: MID + N*STD(CLOSE,M); LOWER: MID - N*STD(CLOSE,M); {布林交易,我想做成突破上轨平空做多。突破下轨平多做空。回到中轨不管!! 要走完一根k线,还保持条件。第二根k线一开始下单!! 条件二是如果突破上下轨x个单位值在当根k线就下单。布林带上中下轨,还有x,都可以调整参数的!! } if ref(cross(h,upper),1) then BEGIN sellshort(1,0,limitr,open); buy(holding=0,1,limitr,open); end
if ref(cross(lower,l),1) then begin sell(1,0,limitr,open); buyshort(holding=0,1,limitr,open); end
if h>upper+x*mindiff then begin sellshort(1,0,thisclose); buy(holding=0,1,thisclose); end
if l<lower-x*mindiff then begin sell(1,0,thisclose); buyshort(holding=0,1,thisclose); end
布林带那个你改上面N和M的赋值就行了
|