以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  求个资金平仓模块  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=58984)

--  作者:wdbbs
--  发布时间:2013/11/20 10:05:30
--  求个资金平仓模块
比如100万,亏10万全部平仓或1000万亏个20万强平。后台下单,高手写个吧
--  作者:jinzhe
--  发布时间:2013/11/20 10:50:45
--  

if date<>ref(date,1) then extgbdataset(\'asset\',tasset);

if todaybar>1 and extgbdata(\'asset\')<=1000000 and extgbdata(\'asset\')-tasset>100000 then tsell(1,0,mkt);//用全局变量记录每天开市时的资金,然后判断当前k线是否有亏损超过10万,超过就平仓

 

1000万资金亏20万的同理,只要改第二句里面的100万和10万

[此贴子已经被作者于2013/11/20 10:50:52编辑过]

--  作者:wdbbs
--  发布时间:2013/11/20 11:16:17
--  
这个太复杂了,这样行不
if taconut2(6,\'\')<910000 and tholding2<>0 then begin
ttell(1,0,\'\');
tshortell(1,0,\'\');
end
if taconut2(6,\'\')<910000 and tholding2=0 then exit;


--  作者:jinzhe
--  发布时间:2013/11/20 11:19:46
--  

也行,这个看自己的需求