jay_zhangzmd 发表于 2016-11-5 13:49:36

大家帮忙看看这段代码有没有未来函数?

AvgValue1 = AverageFC(Close,FastLength);
AvgValue2 = AverageFC(Close,SlowLength);

Hitoday = High;
Lotoday =Low;

MinPoint = MinMove*PriceScale;
    AvgTR = XAverage(TrueRange,ATRLength);
N = AvgTR;
    TotalEquity = Portfolio_CurrentCapital() + Portfolio_UsedMargin();
    TurtleUnits = (TotalEquity*RiskRatio/100) /(N * ContractUnit()*BigPointValue());
    TurtleUnits = IntPart(TurtleUnits); // 对小数取整


Buy_signal = AvgValue1  > AvgValue2   && Lotoday>AvgValue1 ;
Sell_signal = AvgValue1 < AvgValue2  && Hitoday<AvgValue1;
  
If(MarketPosition ==0 && TurtleUnits>=1 && (TotalTrades()==0||(TotalTrades()>0 && BarsSinceExit>0)) )
{  If (Buy_signal )
    {
                 
                 Buy(TurtleUnits,Open);
   
    }Else

    If(Sell_signal)
    {
                SellShort(TurtleUnits,OPEN);;
   
    }
}Else
   
If(MarketPosition == 1) // 有多仓的情况
{   
       If(Sell_signal && TurtleUnits>=1) //如果有空信号,平掉多单并开空
       {
         SellShort(TurtleUnits,OPEN);
         
       }Else
       {
         If( ((CurrentEntries()>=2 && Hitoday < LastEntryPrice()-N ) ||(CurrentEntries()>=3 && Lotoday-LastEntryPrice()>TP*N) ) && MarketPosition == 1)
         {
            Sell(0,OPEN);
   
          }Else
              {
                     
            If ( Hitoday <= LastEntryPrice() - 2* N && SendOrderThisBar == false && MarketPosition == 1) Sell(0,OPEN);// 止损指令
      
                If( CurrentEntries()<=4 && TurtleUnits >= 1  && Buy_signal   && MarketPosition == 1)
                   {
                If(Lotoday >= LastEntryPrice() + 0.5*N)    // 如果开盘就超过设定的1/2N,则直接用开盘价增仓。
                {
                  
                   Buy(TurtleUnits,OPEN);   
        
                }
            }   
                  }  
        }                  
           
  }  

laixiaoping 发表于 2016-11-11 08:56:40

有未来。你预先知道了High
页: [1]
查看完整版本: 大家帮忙看看这段代码有没有未来函数?