hi,ilian

Discussion in 'Wealth-Lab Developer' started by ZWS, Aug 28, 2005.

  1. ZWS

    ZWS

    您好!wld的朋友告诉我用关键词“PositionCount”搜索论坛的词典,可以找到多口交易系统,的确不少,您是否也看看,推荐一些典型的多口交易系统给大家学习呢?
     
  2. ZWS

    ZWS

    我先挂一个

    我先挂一个
    Code:
    Trend-Following-System
    
    
    var H, L, X: float;
    var TETHER, NBAR, PREVOLUMEOSC, VOLUMEOSC, NVOLPANE, MBO, NMBOPANE, BAR: integer;
    { Create the Tether Line }
    Tether := CreateSeries();
    for nBar := 50 to BarCount() - 1 do
    begin
      h := Highest( nBar, #High, 50 );
      l := Lowest( nBar, #Low, 50 );
      x := ( h + l ) / 2;
      SetSeriesValue( nBar, Tether, x );
    end;
    PlotSeries( Tether, 0, 444, 0 );
    
    { Create the Volume Oscillator }
    PreVolumeOsc := CreateSeries();
    for nBar := 7 to BarCount() - 1 do
    begin
      if PriceClose( nBar ) > PriceOpen( nBar ) then
        SetSeriesValue( nBar, PreVolumeOsc, Volume( nBar ) )
      else if PriceClose( nBar ) < PriceOpen( nBar ) then
        SetSeriesValue( nBar, PreVolumeOsc, -Volume( nBar ) );
    end;
    VolumeOsc := SMASeries( PreVolumeOsc, 7 );
    nVolPane := CreatePane( 75, FALSE, FALSE );
    PlotSeries( VolumeOsc, nVolPane, 005, 3 );
    DrawHorzLine( 0, nVolPane, 444, 1 );
    DrawText( 'Volume Oscillator', nVolPane, 4, 4, 005, 8 );
    
    { Create the MBO }
    MBO := CreateSeries();
    for nBar := 200 to BarCount() - 1 do
    begin
      x := SMA( nBar, #Close, 25 ) - SMA( nBar, #Close, 200 );
      SetSeriesValue( nBar, MBO, x );
    end;
    nMBOPane := CreatePane( 75, FALSE, FALSE );
    PlotSeries( MBO, nMBOPane, 500, 3 );
    DrawHorzLine( 0, nMBOPane, 444, 1 );
    DrawText( 'MBO', nMBOPane, 4, 4, 500, 8 );
    
    { Execute the System! $5K per Position }
    for Bar := 200 to BarCount() - 1 do
    begin
      if LastPositionActive() then
      begin
        if PriceClose( Bar ) < GetSeriesValue( Bar, Tether ) then
          SellAtMarket( Bar + 1, PositionCount() - 1, '');
      end
      else
      begin
        if PriceClose( Bar ) > GetSeriesValue( Bar, Tether ) then
          if PriceClose( Bar - 1 ) <= GetSeriesValue( Bar - 1, Tether ) then
            if GetSeriesValue( Bar, VolumeOsc ) > 0 then
              if GetSeriesValue( Bar, MBO ) > GetSeriesValue( Bar - 1, MBO ) then
                BuyAtMarket( Bar + 1, '');
      end;
    end;