麻烦搞个例子,买了只见一堆代码还要琢磨半天,我要是没琢磨好,就在这贴原码了
input:account(888888,1,999999,1);
runmode:0;
begintime:=currenttime>=091500 and currenttime<=145500;
endtime:=currenttime>=145930;
buycond:=begintime;
sellcond:=begintime;
myaccount:=''+account;
mycash:=taccount2(19,myaccount);
myholding:=extgbdata(myaccount+'_'+formulaname+'_'+datatype+'_'+stklabel+'_holding');
slippage:=2*mindiff;
if myholding=0 then begin
if buycond then begin
buyprice:=close+slippage;
lots:=intpart(mycash/(buyprice*multiplier*taccount(41)));
if lots>=1 then begin
tbuy(1,lots,lmt,buyprice,0,myaccount,0);
extgbdataset(myaccount+'_'+formulaname+'_'+datatype+'_'+stklabel+'_holding',lots);
end
end
end
if myholding=0 then begin
if sellcond then begin
sellprice:=close-slippage;
lots:=intpart(mycash/(sellprice*multiplier*taccount(42)));
if lots>=1 then begin
tbuyshort(1,lots,lmt,sellprice,0,myaccount,0);
extgbdataset(myaccount+'_'+formulaname+'_'+datatype+'_'+stklabel+'_holding',-lots);
end
end
end
if myholding>0 then begin
if endtime then begin
tsell(1,myholding,lmt,close-slippage,myaccount,0);
extgbdataset(myaccount+'_'+formulaname+'_'+datatype+'_'+stklabel+'_holding',0);
end
end
if myholding<0 then begin
if endtime then begin
tsellshort(1,myholding,lmt,close+slippage,myaccount,0);
extgbdataset(myaccount+'_'+formulaname+'_'+datatype+'_'+stklabel+'_holding',0);
end
end
Z7C9兄,是否需要购买啊?如何付费啊?如有问题是否接受咨询啊?
这个模板不工作,因为关掉软件后重启,重新取出的值是“0”,而不是原先的值。
而且会导致软件每个K线开始的时候重新下单。