Rss & SiteMap

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

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

标题:调试有执行到语句却没显示

1楼
zita 发表于:2013/12/13 11:13:07
开仓价3583,止盈价3613,第二根k线最高价3621(大于止盈价应该止盈),却没止盈操作,调试时有进入止盈卖出函数啊


源码如下:

图片点击可在新窗口打开查看此主题相关图片如下:f.jpg
图片点击可在新窗口打开查看

input : length(10,10,30,10),lots(1,1,10,1);
input : stoplos(20,20,100,10),stopwin(30,10,100,10);
uppband : ref(hhv(high,length),1);
lowband : ref(llv(low,length),1);
if high > uppband && holding = 0 then
buy(1,lots,limitr,open),ignorecheckprice;//开多仓
else if low < lowband && holding = 0 then
buyshort(1,lots,limitr,open); //开空仓
if holding = 1 && enterbars >= 0 then
 begin
    stoploslin := enterprice - stoplos * mindiff; //止损线
    if low < stoploslin then  
     begin
       myexitprice := stoploslin;
       if open < stoploslin then
       myexitprice  := open;
       sell(1,0,limitr,myexitprice);  //平多仓
     end 
     
     stopwinlin := enterprice + stopwin * mindiff; //止盈线
     if high > stopwinlin then
      begin
      myexitprice := stopwinlin;
      if open > stopwinlin then
      myexitprice := open;
      sell(1,0,limitr,myexitprice);
      end  
 end 
   
else if holding = -1 && enterbars >= 0 then
begin
stoploslin := enterprice + stoplos * mindiff;  //止损线
if high > stoploslin then
begin
  myexitprice := stoploslin; 
  if open > stoploslin then
  myexitprice := open; 
  sellshort(1,0,limitr,myexitprice);
end
 
    stopwinlin := enterprice - stopwin * mindiff;  //止盈线
if low < stopwinlin then
begin
  myexitprice := stopwinlin;
  if open < stopwinlin  then
  myexitprice := open;
  sellshort(1,0,limitr,myexitprice);
end  
end


2楼
yukizzc 发表于:2013/12/13 11:18:36

图表显示K线数据长度和你调试时候长度一致吗?

 

3楼
zita 发表于:2013/12/13 11:26:08
我把  sellshort(1,0,limitr,myexitprice);l改成sellshort(1,0,market);就可以,这什么原因啊
4楼
zita 发表于:2013/12/13 11:31:09

图片点击可在新窗口打开查看此主题相关图片如下:f.jpg
图片点击可在新窗口打开查看
你看下与之前图区别,第二张有平仓,第一张没平仓,只是把limit改成market
[此贴子已经被作者于2013/12/13 11:32:15编辑过]
5楼
yukizzc 发表于:2013/12/13 11:52:07

你加个IGNORECHECKPRICE  //忽视价格检查看下是不是价格超过了k线范围导致的

sellshort(1,0,limitr,myexitprice),,IGNORECHECKPRICE

6楼
zita 发表于:2013/12/13 13:33:01
可以,但怎么不能成交呢,最高价为3600,而限价为3574
7楼
yukizzc 发表于:2013/12/13 13:36:34
最低价多少,3574在K线的价格范围内吗?
8楼
zita 发表于:2013/12/13 13:39:01
最低价3550,在范围内啊
9楼
yukizzc 发表于:2013/12/13 13:55:26

你把limit换成limitr就可以看到信号了,这两个区别在于一个本周期下单另一个次周期下单对应的K线不同导致

可以看下这边介绍http://www.weistock.com/bbs/dispbbs.asp?BoardID=4&ID=52160&replyID=&skin=1

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


Powered By Dvbbs Version 8.3.0
Processed in 0.03027 s, 2 queries.