以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请帮忙看看止盈止扣为什么不能产生作用  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=48070)

--  作者:leonxu
--  发布时间:2013/1/25 14:27:19
--  请帮忙看看止盈止扣为什么不能产生作用


if tholding2=0 then begin
 extgbdataset(\'maxprofit\',0);
 
 //判断当前持仓状态下的最大盈利
 win:=0;
 win2:=0;
end
 
if tavgenterprice>0 then begin

 debugout(\'最新开仓价tavgenterprice=%2.f\',tavgenterprice);
 
 maxprofit:=extgbdata(\'maxprofit\');
 
 if tholding2 > 0  then
 begin
  win:=(c-tavgenterprice)/tavgenterprice*100; //记录最大盈利
   if win > maxprofit then extgbdataset(\'maxprofit\',win);
    win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
 end
 
 if tholding2 < 0  then
 begin
  win:=(tavgenterprice-c)/tavgenterprice*100; //记录最大盈利
  if win > maxprofit then extgbdataset(\'maxprofit\',win);
  win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
 end
end

//出现浮动亏损比如2%平仓
多止损:TSELL(win<=-1*止损,0);
空止损:TSELLshort(win<=-1*止损,0);
 
//出现最高盈利后,回落到盈利的40%平仓出场
多止赢:TSELL(maxprofit>止盈 and win2 >= 50 and topenprofit>0,0);
空止赢:TSELLshort(maxprofit>止盈 and win2 >= 50 and topenprofit>0,0);

 

 


--  作者:jinzhe
--  发布时间:2013/1/25 14:38:42
--  
在全局变量管理器里面看看有没有记录值
--  作者:leonxu
--  发布时间:2013/1/25 15:31:47
--  
监控里是有的输出的
--  作者:leonxu
--  发布时间:2013/1/28 10:41:55
--  

管理器里有值,会不会是,因为比例的原因,小数位太小,系统反应不过来?


--  作者:jinzhe
--  发布时间:2013/1/28 10:51:41
--  
输出相应的值,看条件是否满足,
--  作者:leonxu
--  发布时间:2013/1/28 16:11:38
--  

程序本身在全局变量的应用上有问题吗


--  作者:RogarZ
--  发布时间:2013/1/28 20:50:11
--  

Tsell参数不全~


--  作者:leonxu
--  发布时间:2013/1/29 9:23:12
--  

跟踪了一下,那个maxprofitr 全局变量怎么还会缩小的?按程序要求是记录最大值的。


--  作者:leonxu
--  发布时间:2013/1/29 9:24:19
--  
请问Tsell怎么参数不全法,应该怎么写,不是省略就全卖吗?
--  作者:leonxu
--  发布时间:2013/1/29 11:26:16
--  

跟踪了一下,那个maxprofitr 全局变量怎么还会缩小的?按程序要求是记录最大值的。