Rss & SiteMap

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

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

标题:请问老师怎么编写这个

1楼
qq代人发帖 发表于:2015/11/17 15:25:18
请问,默认交易手数为2,如果上一笔交易亏损,则本次交易1手;如果上一笔交易盈利,则本次交易2手。这个交易思路应该怎么写?
2楼
jinzhe 发表于:2015/11/17 15:32:48

ss:=2;//交易手数为2手

 

if 平多条件 and holding>0 then begin

   sell(1,0,market);

   if numprofit(1)>=0 then ss:=2;

   if numprofit(1)<0 then ss:=1;

end

   

 

if 平空条件 and holding<0 then begin

   sellshort(1,0,market);

   if numprofit(1)>=0 then ss:=2;

   if numprofit(1)<0 then ss:=1;

end

   

3楼
yiyihi 发表于:2015/11/17 15:42:36
 抱歉,老师,可能我没说明白。
默认交易手数是2.策略为非多即空策略。
如果上一笔交易盈利,则本次交易开仓手数为2;
如果上一笔交易亏损,则本次交易开仓手数为1.
您写的好像只是平仓的部分。
4楼
jinzhe 发表于:2015/11/17 15:47:12

variable:ss=2;//交易手数为2手

 

if 平多条件 and holding>0 then begin

   sell(1,0,market);

   if numprofit(1)>=0 then ss:=2;

   if numprofit(1)<0 then ss:=1;

end

   

 

if 平空条件 and holding<0 then begin

   sellshort(1,0,market);

   if numprofit(1)>=0 then ss:=2;

   if numprofit(1)<0 then ss:=1;

end

 

判断盈利之后,SS也跟着变了

SS要用全局变量,我前面重新定义了

[此贴子已经被作者于2015/11/17 15:47:53编辑过]
5楼
yiyihi 发表于:2015/11/17 15:51:58

需要把SS加入到SELL和SELLSHORT的语句里面去吗?

6楼
jinzhe 发表于:2015/11/17 15:58:40
 我已经加了,判断盈亏之后进行赋值
共6 条记录, 每页显示 10 条, 页签: [1]


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