回测时候如何获得applystop的结果?

Discussion in 'AmiBroker' started by forbbs, Dec 30, 2012.

  1. AFL里怎么判断上次是止损还是止盈退出的?
     
  2. [​IMG]

    What do you mean? Please specify. Do you mean a column that outputs the profit/loss in ticks/pips/.../...?
     
  3. How do I know last trade is profit-stop or trailing-stop or lossy-stop in backtesting?
     
  4. Code:
    .
    .
    .
    
    stop = 10;
    
    ApplyStop( stopTypeLoss, stopModePoint, stop, 1 );
    ApplyStop( stopTypeProfit, stopModePoint, 3 * stop, 1 );
    ApplyStop( stopTypeTrailing, stopModePoint, 2 * stop, 1 );
    .
    .
    .

    You will see it in the 'Trade' column.

    [​IMG]
     
  5. Thanks,But I need to know certain trade result in AFL during backtesting,not in final backtesting result.
     
  6. Check the manual for ApplyStop

    Code:
    .
    .
    .
    stop  = 10;
    ApplyStop( stopTypeLoss, stopModePoint, stop, True );
    ApplyStop( stopTypeProfit, stopModePoint, 3 * stop, 1 );
    ApplyStop( stopTypeTrailing, stopModePoint, 2 * stop, 1 );
    
    Equity( 1 );// evaluate stops
    SellSL = /*check SL*/ Sell == 2; 
    SellTP = /*check TP*/Sell == 3;
    SellTrail = /*check Trailing*/ Sell == 4;
    .
    .
    .
    Now you could use those three ones in a condition to check trade result.

    Using Equity( 1 ); to evaluate stops can be used for individual backtest only but not for portfolio, AFAIK. Ask support for confirmation.

    Otherwise you could write your own ApplyStop using loops. It's no difficult.
    Custom backtester procedure of Amibroker is another possibility.