Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共5 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:怎样移动止盈?

1楼
梁超2061 发表于:2019/7/5 11:47:06
DIFF突破0轴开多5手,每盈利10点止盈1手,当DIFF下到0轴,平仓开空5手,每盈利10点止盈1手,DIFF突破0轴平仓

2楼
gxx978 发表于:2019/7/5 13:31:26

需要再明确下你的平仓条件。每盈利10点止盈1手,则盈利20点止盈1手、盈利30点再止盈1手?若价格未盈利20点,又回落到盈利10点的的时候不止盈,直接DIFF下到0轴再全平?

 

3楼
梁超2061 发表于:2019/7/5 13:59:43
是的
4楼
梁超2061 发表于:2019/7/5 13:59:56
是的
5楼
gxx978 发表于:2019/7/5 14:30:43

以下案例仅供参考。

variable:price=0;   //定义全局变量price

 

diff:=ema(close,12)-ema(close,26);

con1:cross(diff,0);
con2:cross(0,diff);

 

if con1 then begin                  //diff上穿0轴时,平空单,开5手多单
   sellshort(holding<0,holding,market);
   buy(holding=0,5,market);
   price:=enterprice;
   end
 
if con2 then begin                  //diff下穿0轴时,平多单,开5手空单
   sell(holding>0,holding,market);
   buyshort(holding=0,5,market);
   price:=enterprice;
   end
  
if holding>0 and c-price>=10*mindiff  then  begin   //多单盈利每10点,平1手
   sell(1,1,market);
   price:=c;
   end
  
if holding<0 and price-c>=10*mindiff then  begin  //空单盈利每10点,平1手
   sellshort(1,1,market);
   price:=c;
   end

[此贴子已经被作者于2019/7/8 9:28:57编辑过]
共5 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.07422 s, 3 queries.