- 金币:
-
- 奖励:
-
- 热心:
-
- 注册时间:
- 2004-4-22
|
|
wma均线双向交易系统
- var Bar, p: integer;
- var bLongSAR: boolean;
- PlotSeries( WMASeries( #Close, 5 ), 0, #Green, #Thick );
- PlotSeries( WMASeries( #Close, 9 ), 0, 030, #Thick );
- Hidevolume;
- for Bar := 10 to BarCount - 1 do
- begin
- if LastPositionActive then
- begin
- p := LastPosition;
- bLongSAR := PositionLong( p );
- if PositionLong( p ) then
- begin
- if CrossUnder( Bar, WMASeries( #Close, 5 ), WMASeries( #Close, 9 ) ) then
- begin
- SellAtMarket( Bar + 1, p, '' );
- end;
- end;
- if PositionShort( p ) then
- begin
- if CrossOver( Bar, WMASeries( #Close, 5 ), WMASeries( #Close, 9 ) ) then
- begin
- CoverAtMarket( Bar + 1, p, '' );
- end;
- end;
- end;
- if not bLongSAR then
- begin
- if CrossOver( Bar, WMASeries( #Close, 5 ), WMASeries( #Close, 9 ) ) then
- begin
- BuyAtMarket( Bar + 1, '0' );
- end;
- end;
- if bLongSAR then
- begin
- if CrossUnder( Bar, WMASeries( #Close, 5 ), WMASeries( #Close, 9 ) ) then
- begin
- ShortAtMarket( Bar + 1, '2' );
- end;
- end;
- end;
复制代码 |
|
|