关于oops交易系统,就是跳空回调后买入。 胜率挺高的,优化后能到60%以上,盈利能力也可以。就是交易次数有点少。就算在《完美的日内交易商2》书中给出的例子,82年4月到98年交易SP500也才177次。可以做为策略池中的一个。针对一日的缺口的代码:- Params
- Numeric gapsize(2); //缺口大小
- Numeric breaksize(3); //突破大小
- Numeric stoploss(10); //止损
- Numeric takeprofit(20); //止盈
- Vars
- Bool isgap;
- Bool temp;
- Numeric enterprice;
- NumericSeries HighestAfterEntry(0);
- NumericSeries LowestAfterEntry(0);
- Begin
- isgap = OpenD(0)>HighD(1)+gapsize; //高开
- temp = Low<HighD(1)-breaksize; //跌破前日最高价
- enterprice = HighD(1)-breaksize-2;
- If(isgap And temp And MarketPosition==0)
- {
- SellShort(1,enterprice);
- LowestAfterEntry=Low;
- }
- isgap = OpenD(0)<LowD(1)-gapsize; //低开
- temp = High>LowD(1)+breaksize; //涨破前日最低价
- enterprice = LowD(1)+breaksize+2;
- If(isgap And temp And MarketPosition==0)
- {
- Buy(1,enterprice);
- HighestAfterEntry=High;
- }
- /*止损止盈部分*/
- If (MarketPosition!=0 And BarsSinceEntry!=0)
- {
- If(MarketPosition==-1)
- {
- LowestAfterEntry = Min(LowestAfterEntry,Low);
- If(High>EntryPrice And LowestAfterEntry>EntryPrice-takeprofit)
- {
- BuyToCover(1,EntryPrice-takeprofit); //空单止盈
- LowestAfterEntry=0;
- } Else If(High>EntryPrice+stoploss) //空单止损
- {
- BuyToCover(1,EntryPrice+stoploss);
- LowestAfterEntry=0;
- }
- }
- If(MarketPosition==1)
- {
- HighestAfterEntry = Max(HighestAfterEntry,High);
- If(Low<EntryPrice And HighestAfterEntry>EntryPrice+takeprofit)
- {
- Sell(1,EntryPrice+takeprofit); //多单止盈
- LowestAfterEntry=0;
- } Else If(Low<EntryPrice-stoploss)
- {
- Sell(1,EntryPrice-stoploss); //多单止损
- LowestAfterEntry=0;
- }
- }
- If((Date[-1]!=InvalidInteger && Date!=Date[-1])||(Date[-1]==InvalidInteger && Date < CurrentDate)) //当日平仓
- {
- Sell(1,Close);
- BuyToCover(1,Close);
- }
- }
- End
复制代码
|