很古老的均线系统,随手写的,初学者可以参考
根据核心原理,大家可以拿去扩充一下,我刚才试着扩充加入其它因子,提升不大,可能是没找到合适的组合吧
Params
Numeric maLen1(10);
Numeric maLen2(50);
Numeric lots(1);
Numeric offset(0);
Vars
Numeric ma1;
Numeric ma2;
Numeric i_offset;
Begin
ma1 = Average(Open,maLen1);
ma2 = Average(Open,maLen2);
PlotNumeric("ma1",ma1);
PlotNumeric("ma2",ma2);
i_offset = offset*MinMove*PriceScale;
If(CurrentBar > maLen2)
{
If(MarketPosition == 0)
{
If(Open>ma1 and ma1>ma2)
{
Buy(lots,Open+i_offset);
Return;
}
If(Open < ma1 and ma1<ma2)
{
SellShort(lots,Open-i_offset);
Return;
}
}
If(MarketPosition == 1)
{
If(Open < ma1)
{
Sell(lots,Open-i_offset);
Return;
}
}
If(MarketPosition == -1)
{
If(Open > ma1)
{
BuyToCover(lots,Open+i_offset);
Return;
}
}
}
End
根据核心原理,大家可以拿去扩充一下,我刚才试着扩充加入其它因子,提升不大,可能是没找到合适的组合吧
Params
Numeric maLen1(10);
Numeric maLen2(50);
Numeric lots(1);
Numeric offset(0);
Vars
Numeric ma1;
Numeric ma2;
Numeric i_offset;
Begin
ma1 = Average(Open,maLen1);
ma2 = Average(Open,maLen2);
PlotNumeric("ma1",ma1);
PlotNumeric("ma2",ma2);
i_offset = offset*MinMove*PriceScale;
If(CurrentBar > maLen2)
{
If(MarketPosition == 0)
{
If(Open>ma1 and ma1>ma2)
{
Buy(lots,Open+i_offset);
Return;
}
If(Open < ma1 and ma1<ma2)
{
SellShort(lots,Open-i_offset);
Return;
}
}
If(MarketPosition == 1)
{
If(Open < ma1)
{
Sell(lots,Open-i_offset);
Return;
}
}
If(MarketPosition == -1)
{
If(Open > ma1)
{
BuyToCover(lots,Open+i_offset);
Return;
}
}
}
End