请老师改成金字塔格式的:
Params
Numeric Lots(1);
Numeric nOffset(3);
Numeric HLength(5);
Numeric LLength(5);
Numeric AtrLength(0.05);
Numeric myBarsSinceEntry(9);
Vars
NumericSeries HHH;
NumericSeries LLL;
NumericSeries HHH1;
NumericSeries LLL1;
NumericSeries Atr;
Numeric myPrice;
NumericSeries StopLine;
NumericSeries LastPrice;
Numeric MinPoint;
Begin
MinPoint = MinMove*PriceScale;
HHH = Highest(High,HLength);
LLL = Lowest(Low,LLength);
HHH1 = Highest(High,10);
LLL1 = Lowest(Low,10);
Atr = AvgTrueRange(10);
If(MarketPosition==1)
{
//LLL1 = Max(LLL1,LastPrice);
LLL1 = Max(LLL1,LLL1[1]);
//PlotNumeric("LLL1",LLL1);
If(BarsSinceEntry>myBarsSinceEntry || High>LastPrice+Atr[1])
{
StopLine = Max(StopLine,LLL1[1] + (BarsSinceEntry)*Atr[1]*AtrLength);
}
PlotNumeric("多头止损:",StopLine);
If(Low<StopLine)
{
myPrice = Min(Open,StopLine) - MinPoint*nOffset;
Sell(Lots,myPrice);
}
}
If(MarketPosition==-1)
{
//HHH1 = Min(HHH1,LastPrice);
HHH1 = Min(HHH1,HHH1[1]);
//PlotNumeric("HHH1",HHH1);
If(BarsSinceEntry>myBarsSinceEntry || Low<LastPrice-Atr[1])
{
StopLine = Min(StopLine,HHH1[1] - (BarsSinceEntry)*Atr[1]*AtrLength);
}
PlotNumeric("空头止损:",StopLine);
If(High>StopLine)
{
myPrice = Max(Open,StopLine) + MinPoint*nOffset;
BuyToCover(Lots,myPrice);
}
}
If(MarketPosition<>1)
{
If(High>HHH[1])
{
myPrice = Max(Open,HHH[1]);
Buy(Lots,myPrice + MinPoint*nOffset);
LastPrice = myPrice;
StopLine = myPrice - Atr[1]*1.5;
Return;
}
}
If(MarketPosition<>-1)
{
If(Low<LLL[1])
{
myPrice = Min(Open,LLL[1]);
SellShort(Lots,myPrice - MinPoint*nOffset);
LastPrice = myPrice;
StopLine = myPrice + Atr[1]*1.5;
Return;
}
}
If(time == 0.1510)
{
Sell(Lots,Open - MinPoint*nOffset);
BuyToCover(Lots,Open + MinPoint*nOffset);
}
End