以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://www.weistock.com/bbs/list.asp?boardid=2)
----  请问日内交易,亏损达到1万就止损不再交易怎么写?  (http://www.weistock.com/bbs/dispbbs.asp?boardid=2&id=72316)

--  作者:lhy5507
--  发布时间:2014/11/24 16:03:20
--  请问日内交易,亏损达到1万就止损不再交易怎么写?
请问日内交易,亏损达到1万就止损不再交易怎么写?
谢谢

--  作者:qq代人发帖
--  发布时间:2014/11/24 16:13:30
--  

//多头为例

VARIABLE:a=0,n=0;
if date<>ref(date,1) then BEGIN
 a:=asset;
 n:=0;
 end
if 开仓条件 and n=0 then buy(holding=0,1,market);

if a-asset>=10000 then begin
sell(holding>0,holding,market);
n:=1;
end

[此贴子已经被作者于2014/11/24 16:14:09编辑过]

--  作者:qwer123
--  发布时间:2014/11/24 16:52:54
--  
r1:=barslast(date<>ref(date,1));
if r1=0 then n1:=1;
if ref(asset,r1+1)-asset>10000 then
begin
sell(1,0,limitr,c);
sellshort(1,0,limitr,c);
n1:=-1;
end
//在开仓条件中加n1>0