Rss & SiteMap

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

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

标题:求助解决

1楼
wjxkjs 发表于:2010/7/16 16:40:18

10)       追踪止赢功能(按回调比例)

input:NS(5,1,100,1);{ 回调比例}
tt0:=time<145000;
tt2:=time>145700;//收盘时间

SELLSHORT(tt0 and BP and 持仓<0,持仓,market);
SELLSHORT(tt0 and 持仓<0,持仓,Stopr, LLV(L,ENTERBARS)*(1+NS/100));
BUY(tt0 and BK and  持仓=0,20%,market);

SELL(tt0 and SP and 持仓>0,持仓,market);
SELL(tt0 and 持仓>0,持仓,Stopr, HHV(H,ENTERBARS)*(1-NS/100));
BUYSHORT(tt0 and SK and 持仓=0,20%,market);

 

这是程序帮助中对追踪止盈的一个范例,在没有加入这里的内容时,我的软件一切正常。加入这部分内容后,发现开仓后就立即平仓的特别多。而且在K线下面基本上每个都有一个三角形,是什么原因?

2楼
admin 发表于:2010/7/16 17:27:43
以上代码无法实现追棕止赢,我们稍后会给大家做一个移动止损得范例
3楼
wjxkjs 发表于:2010/7/16 21:31:07

移动止损的例子,论坛有。希望能有追踪止盈的范例

4楼
wjxkjs 发表于:2010/7/16 22:02:16
http://www.weistock.com/bbs/dispbbs.asp?BoardID=4&ID=1900&replyID=&skin=1
5楼
wjxkjs 发表于:2010/7/16 23:18:02

VARIABLE: aspect=0; //初始化假定做多头
VARIABLE: stopprice=0;//止损价格变量
VARIABLE: stopnum =NS*mindiff; //止损价差
 

if barpos = 0 then
  stopprice := h - stopnum;

if aspect = 0 then
begin
 //多头处理 
 if h <= stopprice then
 begin
  //多反空
  aspect:= 1;
  stopprice := l+stopnum;
 end
 
 //处理移动的底部
 if h - stopnum > stopprice then
  stopprice := h-stopnum;
end

if aspect = 1 then
begin
 //空头处理 
 if l >= stopprice then
 begin
  //空反多
  aspect:= 0;
  stopprice := h-stopnum;
 end
 
 //处理移动的底部
 if l+ stopnum < stopprice then
  stopprice := L+stopnum;

 

老师,仿照移动止损的例子,做了一个移动止盈的,好像测试有效。请老师指点--价格大于stopprice空头止赢

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


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