Rss & SiteMap

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

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

标题:增加止盈止损的问题

1楼
shisudaoren 发表于:2016/9/29 14:07:18
如何在以下平仓条件中增加止损小于30个点,止盈大于45个点,这个代码该如何添加进去。
VARIABLE:VMIN = 090000;
IF (ABS(O-REF(C,1))>=20*MINDIFF AND TIME>090000 AND TIME<090400) THEN VMIN := 091500;
//开多仓条件:
BOPEON1:=C>UPPER AND DIFF>0 AND C>O AND C>MA4 AND HOLDING=0 AND TIME>VMIN AND TIME<162500;
//平多仓条件:
BLIQCON:=HOLDING>0 AND CROSS(MA3,MA2);
//开空仓条件:
SOPCON1:=C<LOWER AND DIFF<0 AND C<O AND C<MA4 AND HOLDING=0 AND TIME>VMIN AND TIME<162500;
//平空仓条件:
SLIQCON:=HOLDING<0 AND CROSS(MA2,MA3);
BUY(BOPEON1,手数,thisclose);
SELL(BLIQCON,HOLDING,thisclose);
BUYSHORT(SOPCON1,手数,thisclose);
SELLSHORT(SLIQCON,HOLDING,thisclose);
2楼
jinzhe 发表于:2016/9/29 14:28:09

if holding>0 and c>enterprice+45 then sell(1,0,marketr);

if holding>0 and c<enterprice-30 then sell(1,0,marketr);

 

if holding<0 and c<enterprice-45 then sellshort(1,0,marketr);

if holding<0 and c>enterprice+30 then sellshort(1,0,marketr);

3楼
shisudaoren 发表于:2016/9/29 14:40:55
BLIQCON:=HOLDING>0 AND CROSS(MA3,MA2) or h>enterprice+45 or  c<enterprice-30 ;
SLIQCON:=HOLDING<0 AND CROSS(MA2,MA3) or l<enterprice-45 or  h>enterprice+30;
老师为什么我这么写不行。
4楼
jinzhe 发表于:2016/9/29 14:43:45
把后面3个条件要括号括起来,不然会先算前面的and
5楼
shisudaoren 发表于:2016/9/29 14:58:13
难怪我一直测试都测试不出来,是这个原因。代码中都是先计算and 再计算 or是吗。
6楼
jinzhe 发表于:2016/9/29 15:07:54
是的
7楼
shisudaoren 发表于:2016/9/29 15:20:12
老师美原油的开盘收盘时间用北京时间怎么表示
8楼
jinzhe 发表于:2016/9/29 15:27:11

早上5点

050000

9楼
shisudaoren 发表于:2016/9/29 16:27:57
交易时间用代码怎么表示。
10楼
jinzhe 发表于:2016/9/29 16:33:55

你要怎么表示?

共21 条记录, 每页显示 10 条, 页签: [1] [2][3]


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