策略描述:短週期(N)均線大於長週期(M)均線則作多,反之做空。
HTS版:
param:N(5),M(10)
var:shortMA(0),LongMA(0)
shortMA= MA( Close, N)
LongMA= MA( Close, M)
if shortMA > LongMA then
Buy next bar Market
end if
if shortMA < LongMA then
Sell next bar Market
end if
MultiCharts版:
input:N(5),M(10);
var:shortMA(0),LongMA(0);
shortMA= Average( Close, N);
LongMA= Average( Close, M);
if shortMA > LongMA then begin
Buy next bar Market;
end;
if shortMA < LongMA then begin
Sellshort next bar Market;
end;
比較上面兩個版本,粗體紅色的就是差異處。