|
发表于 2024-6-30 11:46:48
|
显示全部楼层
猪头三的不如这个:
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
|
|