设为首页收藏本站

 找回密码
 注册
查看: 965|回复: 4

请老师帮忙修改下 [复制链接]

Rank: 1

精华
0
UID
204273
积分
18
帖子
8
主题
4
阅读权限
10
注册时间
2015-3-2
最后登录
2021-10-14
发表于 2019-2-9 14:45:35 |显示全部楼层

在实盘中,如果信号出现了1分钟,就开仓买入,如果信号又消失了就反手,还请帮忙在下面原有的基础上帮忙加上谢谢了。


Params
   
        Numeric delayticks(5);
        Numeric RiskRatio(50);
Vars
   String strkey;
   String strvalue;
   NumericSeries a3;
   NumericSeries a4;
   Numeric lost;
   Numeric TotalEquity;
   numeric turtleunits;
   numeric usemargin;
   
   Numeric lastbartime;
   Numeric tickcounter;

   
   
   
   NumericSeries preEntryPrice(0);        
    BoolSeries PreBreakoutFailure(false);
        Numeric MinPoint;
Begin
  If(!CallAuctionFilter()) Return;

    If(BarStatus == 0)
    {
        preEntryPrice = InvalidNumeric;
        PreBreakoutFailure = false;
    }
   UseMargin=Close*ContractUnit*BigPointValue*MarginRatio;
    TotalEquity=Portfolio_CurrentCapital+Portfolio_UsedMargin;
    TurtleUnits=(TotalEquity*RiskRatio/100)/UseMargin;
    TurtleUnits=IntPart(TurtleUnits);
    lost=turtleunits;
If(barstatus==2 && lastbartime !=time)
{
lastbartime = time;
tickcounter =0;
}
If(con1)
{
   If(marketposition== 0 || barstatus !=2)
   {
   Buy(lost,Open);
   
   Commentary("多头开仓");
   }Else
   {
   BuyToCover(lost,Open);
   
   If(tickcounter == 0)
   {
   tickcounter =1;
   }else if (tickcounter<delayticks)
   {
   tickcounter=tickcounter+1;
   }else
   {
    Buy(lost,Open);
   Commentary("多头开仓");
   }
   }
   }
If(con2)
{
If(marketposition == 0 ||barstatus !=2)
{
SellShort(lost,Open);
Commentary("空头开仓");
}else
{
SellShort(lost,Open);
Commentary("空头开仓");
if(tickcounter == 0)
{
tickcounter =1;
}else if (tickcounter<delayticks)
{
tickcounter = tickcounter +1;
}else
{
  SellShort(lost,Open);
Commentary("空头开仓");
}
}
}

End

Rank: 1

精华
0
UID
204273
积分
18
帖子
8
主题
4
阅读权限
10
注册时间
2015-3-2
最后登录
2021-10-14
发表于 2019-2-11 10:11:35 |显示全部楼层
版主在吗

使用道具 举报

Rank: 1

精华
0
UID
204273
积分
18
帖子
8
主题
4
阅读权限
10
注册时间
2015-3-2
最后登录
2021-10-14
发表于 2019-2-11 11:43:29 |显示全部楼层
li19801068 发表于 2019-2-11 10:11
版主在吗

今天实盘只出现平仓信号没有反手信号,帮忙看下这个哪里有问题!

Params
    Numeric lots(1);
        Numeric delayticks(5);
       
Vars
   String strkey;
   String strvalue;
   NumericSeries a3;
   NumericSeries a4;
   Numeric lost;
   Numeric lastbartime;
   Numeric tickcounter;
   String A_AccountID;

Begin
  If(! callauctionfilter())return;
  lastbartime=GetGlobalVar(0);
  tickcounter=GetGlobalVar(1);
  strkey=DateToString(date)+TimeToString(time);
  strvalue=GetTBProfileString(symbol+"a3",strkey);

  If(strvalue != invalidstring)
  {
  a3=Value(strvalue);
}Else
{
  a3 = a3[1];
}
strkey=DateToString(date)+TimeToString(time);
  strvalue=GetTBProfileString(symbol+"a4",strkey);
    If(strvalue != invalidstring)
    {
   a4=Value(strvalue);
}Else
{
  a4 = a4[1];
}

If(barstatus==2 && lastbartime !=time)
{
lastbartime = time;
tickcounter =0;
}
If(MarketPosition <>1 && a3>a4)
{
  If(marketposition== 0 || barstatus !=2)
   {
   Buy(lost,Open);

   }Else
   {
   BuyToCover(lost,open);
   If(tickcounter == 0)
   {
   tickcounter =1;
   }else if (tickcounter<delayticks)
   {
   tickcounter=tickcounter+1;
   }else
   {
    Buy(lost,Open);
  
   }
   }
   }
If(MarketPosition <>-1 && a3<a4)
{
If(marketposition== 0 || barstatus !=2)
   {
SellShort(lost,Open);

}else
{
Sell(lost,Open);

if(tickcounter == 0)
{
tickcounter =1;
}else if (tickcounter<delayticks)
{
tickcounter = tickcounter +1;
}else
{
  SellShort(lost,Open);

}
}
}

End
附件: 你需要登录才可以下载或查看附件。没有帐号?注册

使用道具 举报

Rank: 1

精华
0
UID
204273
积分
18
帖子
8
主题
4
阅读权限
10
注册时间
2015-3-2
最后登录
2021-10-14
发表于 2019-2-11 13:00:18 |显示全部楼层
li19801068 发表于 2019-2-11 11:43
今天实盘只出现平仓信号没有反手信号,帮忙看下这个哪里有问题!

Params



如果这个空平是  多平仓的话,这个黄色信号,是空开仓,但我设定的开仓条件是“OPEN” 开盘价,我们一般开盘价讲的是21:00是吗?那今天春节后的第一个交易日是8:00,是不是不算开盘价,所以只有信号,没有下单
附件: 你需要登录才可以下载或查看附件。没有帐号?注册

使用道具 举报

Rank: 10Rank: 10Rank: 10

精华
3
UID
5
积分
26584
帖子
12686
主题
49
阅读权限
200
注册时间
2007-7-20
最后登录
2021-11-3
发表于 2019-2-11 16:51:28 |显示全部楼层
li19801068 发表于 2019-2-11 13:00
如果这个空平是  多平仓的话,这个黄色信号,是空开仓,但我设定的开仓条件是“OPEN” 开盘价,我们一 ...

红圈内是买平,即空头平仓指令。

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-4-18 18:49

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部