exposure ?

Discussion in 'Wealth-Lab Developer' started by redchina, Oct 26, 2005.

  1. 在WLD 测试中有一项exposure 其具体的含义是什么?
    是头寸持有时间/总测试时间呢,还是再乘以投入资金比例呢
     
  2. 应该是,每天:资产净值-现金的总和/每天:资产净值的总和。

    我用WLD写了例子和WLD内置的AccountExposure结果稍有点误差。

    var Bar, p : integer;
    var sumec,sumequity,myexposure:float;

    for Bar := 20 to BarCount - 1 do
    begin
    if LastPositionActive then
    begin
    p := LastPosition;
    SellAtStop( Bar + 1, Lowest( Bar, #Low, 10 ), p, 'Stop' );
    end
    else
    begin
    if not LastPositionActive then
    begin
    BuyAtStop( Bar + 1, Highest( Bar, #High, 20 ), '0' );
    end;
    end;
    //开始计算exposure
    Sumec:=Equity(Bar)-Cash(bar)+Sumec;
    sumequity:=sumequity+Equity(Bar);
    if bar=BarCount-1 then begin
    myexposure:=Sumec/sumequity*100;
    Print( floatToStr( myexposure ) );
    end
    end;

    结果再 Debug window 可看到。
     
  3. 原来WLD内置的AccountExposure计算方法Bar初值由0开始,把“上面的代码“for Bar := 20 to BarCount - 1 do”改为
    “for Bar := 0 to BarCount - 1 do”结果和Performance报告中的Exposure将一致。

    如下:

    var Bar, p : integer;
    var sumec,sumequity,myexposure:float;

    for Bar := 0 to BarCount - 1 do
    begin
    if Bar>=20 then begin
    if LastPositionActive then
    begin
    p := LastPosition;
    SellAtStop( Bar + 1, Lowest( Bar, #Low, 10 ), p, 'Stop' );
    end
    else
    begin
    if not LastPositionActive then
    begin
    BuyAtStop( Bar + 1, Highest( Bar, #High, 20 ), '0' );
    end;
    end;
    end;
    //开始计算exposure
    Sumec:=Equity(Bar)-Cash(bar)+Sumec;
    sumequity:=sumequity+Equity(Bar);
    if bar=BarCount-1 then begin
    myexposure:=Sumec/sumequity*100;
    Print( floatToStr( myexposure ) );
    end
    end
     
  4. 非常感谢战神觉者! 我对这个问题一直模糊,今天得以解惑!