请老师帮我看一下,这个小量化程序怎么会出现 信号闪烁?
请求帮忙解决
Params
Numeric qdjglow(18000); // 低价——价格区间
Numeric qdjghi(20000); // 高价——价格区间
Numeric wgjg(500); // 每个网格间格的价格是多少
Numeric Lots(1); // 交易手数
Numeric pc(10); // 平仓时网络处加多少平仓
Vars
Global Numeric qdjg(20000);
Global Array<Numeric> n;
Global Array<Numeric> jdj;
Global Array<Numeric> pcj;
Numeric i(0);
Global Numeric scount(1); // 循环次数
Events
//初始化事件函数,策略运行期间,首先运行且只有一次,
OnInit()
{
qdjg=qdjglow;
}
OnBar(ArrayRef<Integer> indexs)
{
scount=(qdjghi-qdjglow)/wgjg;
For i = 0 To scount
{
// 开空仓
If(High[1] <qdjg+wgjg*i And High >= qdjg+wgjg*i And n[i] == 0 and High>qdjglow and High<qdjghi)
{
SellShort(Lots, qdjg+wgjg*i);
n[i] = 1;
Commentary("1n"+text(i));
}
// 平空仓
If( Low <= qdjg+wgjg*(i-1)-pc And n[i] == 1)
{
BuyToCover(Lots, qdjg+wgjg*(i-1)-pc);
n[i] = 0;
Commentary("2n"+text(i));
}
}
}
图表交易不要用global类型做信号条件
具体原理视频课程里有,搜索一下了解一下原理
请问具体是那一个视频,给我一个链接,我仔细学一下
用这个 GetGlobalVar 会造成闪烁吗?