以下策略有未来函数的情况,麻烦各位老师点拨一下
Params
Numeric P1(20);
Numeric P2(10000);
Vars
Series<Numeric> UpperBand;// 通道上轨
Series<Numeric> LowerBand;// 通道下轨
Series<Numeric> ATRVal;// ATRVal值
Numeric Lots(0);// 仓位
Events
OnReady()
{
}
OnBar(ArrayRef<Integer> indexs)
{
Numeric MinPoint = MinMove * PriceScale;// 最小变动价位
UpperBand = Highest(High[1],P1);
LowerBand = Lowest(Low[1],P1);
ATRVal = AvgTrueRange(14);
PlotNumeric("UpperBand", UpperBand);
PlotNumeric("LowerBand", LowerBand);
Lots = IntPart(P2/(ATRVal * 3 * ContractUnit() * BigPointValue()));
If(MarketPosition == 0)
{
// 开多
If(High > UpperBand)
{
Buy(Lots,UpperBand);
}
// 开空
If(Low < LowerBand)
{
SellShort(Lots,LowerBand);
}
}
If(MarketPosition > 0)
{
// 反转平多
If(Low < LowerBand)
{
Sell(0,LowerBand);
Commentary("多单反转平仓:"+Text(LowerBand));
}
}
If(MarketPosition < 0)
{
// 反转平空
If(High > UpperBand)
{
BuyToCover(0,UpperBand);
Commentary("空单反转平仓:"+Text(UpperBand));
}
}
}
手数计算?
ATRVal[1]
嗯
哪里有未来函数?
在工作区运行时,提示有未来函数
1分钟级别
信号闪烁,说错了
那就是楼上同学说的 手数计算的时候 使用当根ATR数据会闪