- 精华
- 0
- 在线时间
- 393 小时
- UID
- 120840
- 积分
- 147
- 帖子
- 79
- 阅读权限
- 40
- 注册时间
- 2013-7-1
- 最后登录
- 2015-12-27
- 精华
- 0
- UID
- 120840
- 积分
- 147
- 帖子
- 79
- 主题
- 44
- 阅读权限
- 40
- 注册时间
- 2013-7-1
- 最后登录
- 2015-12-27
|
策略如下
Params
Numeric Length1(7) ;
Numeric Length2(14) ;
Vars
NumericSeries rsivalue1;
NumericSeries rsivalue2;
Begin
RSIValue1 = rsi(Length1);
RSIValue2 = rsi(Length2);
If( MarketPosition<>1 And CrossOver(rsivalue1,rsivalue2));
Buy(1,C);
If(MarketPosition<>-1 AND CrossUnder(RSIValue1,RSIValue2)); //
SellShort(1,C);
End
其中的RSI 是个 用户函数如下
/ 简称: RSI
// 名称: RSI函数
// 类别: 用户函数
// 类型: 用户函数
// 输出: 数值型
//------------------------------------------------------------------------
Params
Numeric Length(14) ;
Vars
NumericSeries NetChgAvg( 0 );
NumericSeries TotChgAvg( 0 );
Numeric SF( 0 );
Numeric Change( 0 );
Numeric ChgRatio( 0 ) ;
NumericSeries rsivalue( 0 ) ;
Begin
If(CurrentBar <= Length - 1)
{
NetChgAvg = ( Close - Close[Length] ) / Length ;
TotChgAvg = Average( Abs( Close - Close[1] ), Length ) ;
}Else
{
SF = 1/Length;
Change = Close - Close[1] ;
NetChgAvg = NetChgAvg[1] + SF * ( Change - NetChgAvg[1] ) ;
TotChgAvg = TotChgAvg[1] + SF * ( Abs( Change ) - TotChgAvg[1] ) ;
}
If( TotChgAvg <> 0 )
{
ChgRatio = NetChgAvg / TotChgAvg;
}else
{
ChgRatio = 0 ;
}
RSIValue = 50 * ( ChgRatio + 1 );
RETURN RSIValue ;
End
在所有的K线都有 Buy Sell SeLLShort BuyToCover四个交易信号l
请教那位高手知道问题出在哪里 |
|