type(1)前一个
type(2)前二个
type(3)前三个
。。。。。。。
你对函数说明理解不深
type(1)表示获取上一次交易的类型
这个结果返回是1的话,就表示上一次交易为开多
也就是type(1)=1,判断上一次交易是不是开多
if type(1) and cross(d,k) then begin
平多b:sell(holding>0,holding,market);
开空b:buyshort(holding=0,1,market);
end
if type(3) and cross(k,d) then begin
平空a:sellshort(holding<0,holding,market);
开多a:buy(holding=0,1,market);
end
谢谢
if type(1)=1 and cross(d,k) then begin
平多b:sell(holding>0,holding,market);
开空b:buyshort(holding=0,1,market);
end
if type(1)=3 and cross(k,d) then begin
平空a:sellshort(holding<0,holding,market);
开多a:buy(holding=0,1,market);
end