函数使用

SetOrderMap2AppointedSymbol(symbols, multiples);  

这个函数能不能在OnBar里使用,能不能多次使用。

如:

 Events
    onBar(ArrayRef<Integer> indexs)
    {    
    //代码正文
    //If(!CallAuctionFilter()) Return;
    symbols1 = fRollover[1][0];
    symbols2 = fRollover[0][0];
    multiples = 1;
    value1=xaverage(open,LengthShort)-xaverage(open,LengthLong); //value1是9周期指数移动平均减去45周期指数移动平均
    bias1=xaverage(value1,n); //bias1是value1的2周期平均
    bias=bias1[1];
    
    ma1=xaverage(open,LengthShort);
    ma2=xaverage(open,LengthLong);
    
    http://mp.weixin.qq.com/s/mddsIyfTK_IN3zn2ojoKaw 
    
    if (ma1[1]>=ma2[1] and MarketPosition==0 and Bias[2]>bias[1] and Bias[1] <Bias and Bias<BIASLength) //做多:condition1为真,倒数第二根k线的Bias变量>倒数第一根k线的Bias变量,倒数第一根k线的Bias变量<当前k线的Bias变量,Bias变量<6
    
    {
        SetOrderMap2AppointedSymbol(symbols2, multiples);     
        Buy(0,open);//下一k线做多
    }
    if (ma1[1]<ma2[1])//平多:如果9周期指数移动平均下穿45周期指数移动平均
    { 
        
        sell (0,open);  //下一k线平多
    }
    
    if (ma1[1]<=ma2[1] and MarketPosition==0 and Bias[2]<bias[1] and Bias[1] >Bias and Bias<BIASLength)//做空:condition2为真,倒数第二根k线的Bias变量<倒数第一根k线的Bias变量,倒数第一根k线的Bias变量>当前k线的Bias变量,Bias变量<6
    {
        SetOrderMap2AppointedSymbol(symbols2, multiples); 
        sellshort (0,open); //下一k线做空
    }
    if (ma1[1]>ma2[1])//平空:如果9周期指数移动平均上穿45周期指数移动平均
    {
    buytocover (0,open); //下一k线平空
    }
   If(GetDicTime(fRollover, 0) <> GetDicTime(fRollover, 1) And fRollover[0][1] <> InvalidString And fRollover[0][2] <> InvalidString)            
                            {
                            PlotBool("换月", True);
                            //myRollover = rClose / Value(fRollover[0][2]);
                            Commentary("原合约收盘价:" + fRollover[0][1]);
                            Commentary("新合约收盘价:" + fRollover[0][2]);
                            Commentary("symbols:" + fRollover[1][0]);
                            Commentary("multiples:" + Text(multiples[1]));
                            
                            //Lots = Max(1, Round(CurrentContracts * Value(fRollover[0][1]) / Value(fRollover[0][2]),0));
                            
                            If(MarketPosition == 1)
                            {
                                SetOrderMap2AppointedSymbol(symbols1, multiples);
                                Sell(0, Value(fRollover[0][1]),Enum_Signal_UnCorrectPrice);
                                SetOrderMap2AppointedSymbol(symbols2, multiples);
                                Buy(0, Value(fRollover[0][2]),Enum_Signal_UnCorrectPrice);
                            }
                            Else If(MarketPosition == -1)
                            {
                                SetOrderMap2AppointedSymbol(symbols1, multiples);
                                BuyToCover(0, Value(fRollover[0][1]),Enum_Signal_UnCorrectPrice);
                                SetOrderMap2AppointedSymbol(symbols2, multiples);
                                SellShort(0, Value(fRollover[0][2]),Enum_Signal_UnCorrectPrice);
                            }  
                           
    }}
 

关于获取两时间点之间的可交易秒数TradingTotalSecs函数使用的问题
SetTBProfileString和GetTBProfileString 这两个函数使用时,变量里面没有文件名参数,请问这两个文件是对哪个文件进行操作
SetTBProfileString和GetTBProfileString 这两个函数使用时,是对什么文件进行操作,同时为何测试,写进去和读出来值不一样?
咨询函数使用问题
咨询函数使用
A函数使用
编译和函数使用问题
期权函数使用问题
Fileappend()及SetTBProfileString2File函数使用问题
5月22日 | 线上培训 - TBQuant3-A函数使用若干答疑