Rss & SiteMap

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

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

标题:求助

1楼
kingmoonwang 发表于:2012/7/16 12:44:21

1.收盘价同时在5日线以及10日线之上时开仓,这时怎样记录开仓位置K线的最高点。

 

2. 以股指为例,开仓同上,盈利20点以后开始保本止盈,也就是回撤到开仓价+1点时平仓出局。

 

 

请问以上语句怎样写啊?多谢。

2楼
小布丁 发表于:2012/7/16 13:38:23
以下是引用kingmoonwang在2012-7-16 12:44:21的发言:

1.收盘价同时在5日线以及10日线之上时开仓,这时怎样记录开仓位置K线的最高点。

 

2. 以股指为例,开仓同上,盈利20点以后开始保本止盈,也就是回撤到开仓价+1点时平仓出局。

 

 

请问以上语句怎样写啊?多谢。

第一个问题:以hh来表示开仓位置K线最高点

第一种方法:

buycond:=c>ma(c,5) and c>ma(c,10);
selcond:=c<ma(c,5) and c<ma(c,10);
if holding>0 and selcond then sell(1,1,limitr,c);
if holding<0 and buycond then sellshort(1,1,limitr,c);
if holding=0 and buycond then buy(1,1,limitr,c);
if holding=0 and selcond then buyshort(1,1,limitr,c);

hh:=ref(h,enterbars);

 

第二种方法:

buycond:=c>ma(c,5) and c>ma(c,10);
selcond:=c<ma(c,5) and c<ma(c,10);
if holding>0 and selcond then sell(1,1,limitr,c);
if holding<0 and buycond then sellshort(1,1,limitr,c);
if holding=0 and buycond then begin
 buy(1,1,limitr,c);
 hh:=h;
end
if holding=0 and selcond then 
buyshort(1,1,limitr,c);

 

第二个问题:

见【阿火秘笈】之二

http://www.weistock.com/bbs/dispbbs.asp?boardid=10&Id=9439

3楼
kingmoonwang 发表于:2012/7/16 13:40:42

很详细。多谢啦。

4楼
just 发表于:2012/7/16 14:10:36

 

1. variable:hh=0;

    if c>ma5 and c>ma10 then

    begin

    buy(1,1,market);

    hh:=h;

    end

   

 

 

 

共4 条记录, 每页显示 10 条, 页签: [1]


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