全部 智大领峰 TBQuant功能 TBL语言 TB开户 问答专区 高手圈 其他
Buy(a,Max(Open,highline));//a不能为变量吗?
2022-03-21 15:56

    Params
           
    Vars
        Numeric highline;            //高点连线
        Numeric lowline;            //低点连线
        Numeric myprice;            //委托价格
        Numeric lots;                //委托数量
        Numeric money(100000);             //浮盈开仓:单位万 
    Events
    OnInit()
    {
        //=========交易相关设置==============
    SetInitCapital(100000);    //设置初始资金为10万        
    }                    
    OnBar(ArrayRef<Integer> indexs)
    {
        myprice=Open;//这里使用open,更为精确的是使用委托价格
        lots=IntPart(A_FreeMargin/(myprice*contractunit*BigPointValue)); //计算开仓手数
       // lots=5;
       Commentary("可交易手数lots"+text(lots));
        highline=Highest(High[1],20);
        lowline=Lowest(Low[1],20);
        If(MarketPosition<>1 And High>=highline)
         Buy(lots,Max(Open,highline));
        If(MarketPosition<>-1 And Low<=lowline)
         {Sell(lots,Min(Open,lowline));
           }
    }

这个在交易策略下使用不出交易信号.。

 

    Params
           
    Vars
        Numeric highline;            //高点连线
        Numeric lowline;            //低点连线
        Numeric myprice;            //委托价格
        Numeric lots;                //委托数量
        Numeric money(100000);             //浮盈开仓:单位万 
    Events
    OnInit()
    {
        //=========交易相关设置==============
    SetInitCapital(100000);    //设置初始资金为10万        
    }                    
    OnBar(ArrayRef<Integer> indexs)
    {
        myprice=Open;//这里使用open,更为精确的是使用委托价格
        lots=IntPart(A_FreeMargin/(myprice*contractunit*BigPointValue)); //计算开仓手数
       // lots=5;
       Commentary("可交易手数lots"+text(lots));
        highline=Highest(High[1],20);
        lowline=Lowest(Low[1],20);
        If(MarketPosition<>1 And High>=highline)
         Buy(5,Max(Open,highline));
        If(MarketPosition<>-1 And Low<=lowline)
         {Sell(5,Min(Open,lowline));
           }
    }

//这个正常出交易信号,开仓、平仓数为5.

 

 

 

202****3125645033

怎么回事,有大神能指点一下吗?

2022-03-21 15:56
您未登录,请先 登录注册 后发表评论
顶部