Params
Numeric length(14);
Numeric OverSold(20);
Numeric OverBought(80);
Vars
NumericSeries WRValue;
Bool Con1;
Bool Con2;
Numeric StopLossSet(20);
Numeric MinPoint;
Numeric MyExitPrice;
Numeric MyEntryPrice;
Begin
If(!CallAuctionFilter())Return;
WRValue=PercentR(length);
PlotNumeric("WR",WRValue);
PlotNumeric("超卖",OverBought);
PlotNumeric("超买",OverSold);
MinPoint=MinMove*PriceScale;
Con1=CrossOver(WRValue[1],OverBought);
Con2=CrossUnder(WRValue[1],OverSold);
If(Con1 And MarketPosition==0 And Vol>0)
{
SellShort(1,Open);
MyEntryPrice=Open;
If(High>MyEntryPrice+StopLossSet*MinPoint)
{
MyExitPrice=MyEntryPrice+StopLossSet*MinPoint;
If(Open>MyExitPrice)MyExitPrice=Open;
BuyToCover(1,MyExitPrice);
}
If(Con2 And MarketPosition==1 And Vol>0)
BuyToCover(1,Open);
}
Else If(Con2 And MarketPosition==0 And Vol>0)
{
Buy(1,Open);
MyEntryPrice=Open;
If(Low<MyEntryPrice-StopLossSet*MinPoint)
{
MyExitPrice=MyEntryPrice-StopLossSet*MinPoint;
If(Open<MyExitPrice)MyExitPrice=Open;
Sell(1,MyExitPrice);
}
If(Con1 And MarketPosition==1 And Vol>0)
Sell(1,Open);
}
End