如何在wld 设置自动交易?

Discussion in 'Wealth-Lab Developer' started by fisher, Mar 15, 2006.

  1. 我按照wld 说明(Preparing for Automated Trading)
    进行了以下几步设置:
    1.定义chartscript (wld附带)
    { A Real-Time testing script that issues buys and sells every other bar }

    const MYPORT = ''; // Ensure an empty string, not a white space
    var BBAvg,BBAvgDn, Bar, P, Period: integer;
    var BasisPrice, Profit, Limit: Float;

    Period := 5;
    Profit := 0.0175;
    Limit := 0.01;

    BBAvg := BBandLowerSeries(#Close, Period, 1);
    BBAvgDn := MultiplySeriesValue(BBAvg, (1-Limit));

    EnableTradeNotes(False, False, False);
    PlotSeries( BBAvg, 0, #Silver, #Thick );
    PlotSeries( BBAvgDn, 0, #Red, #Thick );

    for Bar := 2*Period to BarCount - 1 do
    begin
    PortfolioSynch( Bar, MYPORT );
    if ActivePositionCount = 0 then
    BasisPrice := 0;
    if ActivePositionCount > 0 then

    if SellAtLimit(Bar+1, BasisPrice*(1+Profit), #All, 'Sell') then
    BasisPrice := 0;

    if BuyAtLimit( Bar + 1, @BBAvgDn[Bar], 'Long') then
    begin
    p := ActivePositionCount;
    BasisPrice := (BasisPrice*(P-1) + PositionEntryPrice(LastPosition))/P;
    end;

    end; ;
    2.在order manager 选定了自已做的broker 接口,linke portfolio 选定已经设好的 帐户"test" (里面只有cash :11000)

    3.打开realtime scan
    在交易时段中scanresult 生成了几个结果,但这些结果的share 和我自定帐户"test"内的现金可买数对不上!
    如:其中一结果为share 31000 Price 5.2 ,但我的现金只有11000.

    不知是否与rt scan 内positionsizing 设置有关,应该如何才能设置自动交易与自定义帐户关连?
     
  2. 自己顶一下