- 精华
- 0
- 在线时间
- 1023 小时
- UID
- 38411
- 积分
- 669
- 帖子
- 160
- 阅读权限
- 60
- 注册时间
- 2011-5-8
- 最后登录
- 2023-10-4
- 精华
- 0
- UID
- 38411
- 积分
- 669
- 帖子
- 160
- 主题
- 17
- 阅读权限
- 60
- 注册时间
- 2011-5-8
- 最后登录
- 2023-10-4
|
inputs: FastLength( 5 ), SlowLength( 12 ), MACDLength( 7 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;
var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
condition1 = CurrentBar > 2 and var2 crosses over 0 ;
condition2 = CurrentBar > 2 and var2 crosses under 0 ;
condition3 = FastLength crosses over SlowLength ;
condition4 = FastLength crosses under SlowLength ;
condition5 = condition1 and condition3;
condition6 = condition2 and condition4;
if marketposition= 0 then
if condition5 then
Buy ( "MacdLE" ) next bar at (high+low)/2 stop ;
if condition6 then
Sell Short ( "MacdSE" ) next bar at (high+low)/2 stop ;
if marketposition= 1 and condition3 then
sell next bar at market ;
if marketposition= -1 and condition4 then
Buytocover next bar at market ; |
|