大家帮忙看看这段代码有没有未来函数? [开拓者 TB]
-
咨询内容:
AvgValue1 = AverageFC(Close,FastLength);
AvgValue2 = AverageFC(Close,SlowLength);
Hitoday = High;
Lotoday =Low;
MinPoint = MinMove*PriceScale;
AvgTR = XAverage(TrueRange,ATRLength);
N = AvgTR[1];
TotalEquity = Portfolio_CurrentCapital() + Portfolio_UsedMargin();
TurtleUnits = (TotalEquity*RiskRatio/100) /(N * ContractUnit()*BigPointValue());
TurtleUnits = IntPart(TurtleUnits); // 对小数取整
Buy_signal = AvgValue1[1] > AvgValue2[1] && Lotoday>AvgValue1[1] ;
Sell_signal = AvgValue1[1] < AvgValue2[1] && Hitoday<AvgValue1[1];
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);
}
}
}
}
} - TB技术人员: 有未来。你预先知道了High
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容