以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  如何自己记录开平仓价格及画止损线  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=9405)

--  作者:businessj
--  发布时间:2011/12/15 23:12:24
--  如何自己记录开平仓价格及画止损线

如何在交易策略中能够记录开仓和平仓的价格,并且在开仓时设置国定止损比例1%,并画止损线,平仓时再取消已经画过的止损线!

可以举例说明:以5天线金叉10天线为买入,用固定轮询发交易,记录当时的开仓价格,并且按照开仓价*0.99作为止损价格,并且划线;

等到5天线死叉10天线时为平多仓信号,并取消原来的止损线;然后记录死叉的价格卖空,并画开仓价格*1.01的止损线?

如果做得更好,要求盘中有多个信号时,能做到只记录首个开仓信号并画止损线;


--  作者:jinzhe
--  发布时间:2011/12/16 9:03:28
--  

5天的什么线金叉10天的什么线?

[此贴子已经被作者于2011-12-16 9:05:17编辑过]

--  作者:jinzhe
--  发布时间:2011/12/16 10:54:47
--  

variable:aa=0;

 

if cond1 then begin
 sellshort(holding<0,0,thisclose);
 buy(holding=0,1,thisclose);
 
end

if cond2 then begin
 sell(holding>0,0,thisclose);
 buyshort(holding=0,1,thisclose);
 
end
if holding<>ref(holding,1) then begin
 aa:=enterprice;
 
end

drawline(holding>0,aa*0.99,holding<0,ref(aa,1)*0.99,0);
drawline(holding<0,aa*1.01,holding>0,ref(aa,1)*1.01,0);

 

如何改平仓 后让前面的止损线消失我再想想