哪位用过WLD里面的expectancy

Discussion in 'Wealth-Lab Developer' started by ZWS, Jan 1, 2006.

  1. ZWS

    ZWS

    哪位用过WLD里面的expectancy?

    他的算法有问题吗?

    turtle 和 thermostat 都是负的期望值???
     
  2. ZWS

    ZWS

    测评expectancy

    测评expectancy

    出现附件的错误怎么办????
     
  3. 是这样调用的:
    {$I 'Expectancy'}
    你的系统代码
    ExpectancyScore;


    例:

    {$I 'Expectancy'}

    var Bar: integer;
    for Bar := 10 to BarCount - 1 do
    begin
    if CrossOver( Bar,#Close, SMASeries( #Close, 20 ) ) then
    BuyAtclose( Bar, '' )
    else
    if CrossUnder ( Bar,#Close, SMASeries( #Close, 20 ) ) then
    SellAtClose ( Bar ,LastPosition, '' );
    end;

    ExpectancyScore;

    结果可直接再WLD的 commentary window 窗口看到。
     
  4. ZWS

    ZWS

    这个问题不是在所有股票上出现,

    谢ilian!
    这个问题不是在所有股票上出现,
    只在个别股票上出现
    怎么办??
     
  5. Re: 这个问题不是在所有股票上出现,

    把源代码贴上来看看。
     
  6. ZWS

    ZWS

    代码

    var Bar,kSMA,UpBnd,LoBnd,per1:integer;
    var W:float;

    {$I 'Expectancy'}

    W:=1.0; {channel halfwidth,ATR}
    per1:=40; {period of price and band SMAs}
    kSMA:=SMASeries(#AverageC,per1);
    UpBnd:=AddSeries(kSMA,MultiplySeriesValue
    (ATRSeries(per1),W));
    LoBnd:=SubtractSeries(kSMA,MultiplySeriesValue
    (ATRSeries(per1),W));

    for Bar:=per1 to BarCount-1 do
    begin

    {Exit trades}
    if LastPositionActive then
    begin
    if PositionLong(LastPosition) then
    SellAtStop(Bar+1,@kSMA[Bar],LastPosition,'');
    if PositionShort(LastPosition) then
    CoverAtStop(Bar+1,@kSMA[Bar],LastPosition,'');
    end
    else

    {Enter trades}
    begin
    if @kSMA[Bar]>@kSMA[Bar-1] then
    {if PriceHigh(Bar)<@UpBnd[Bar] then}
    BuyAtStop(Bar+1,@UpBnd[Bar],'');
    if @kSMA[Bar]<@kSMA[Bar-1] then
    {if PriceLow(Bar)>@LoBnd[Bar] then}
    ShortAtStop(Bar+1,@LoBnd[Bar],'');
    end;
    end;

    {Plotting}
    PlotSeries(kSMA,0,#Blue,#Thick);
    PlotSeries(UpBnd,0,#Blue,#Dotted);
    PlotSeries(LoBnd,0,#Blue,#Dotted);
    DrawLabel('Price SMA - solid line',0);
    Drawlabel('Up/LoBand - dotted line',0);

    var ex: float;
    ex := expectancy();
    DrawText( 'Expectancy: '+ FloatToStr(ex), 0, 12, 20, #Black, 16 );



    问题出在600022
     
  7. 我这里没有发现问题。
     
  8. ZWS

    ZWS

    我的数据从飞狐导出

    我的数据从飞狐导出

    在simulator过程中