I know this should be simple, but can't figure out how to code it in
AFL.  Many thanks in advance.

I want to add some custom metrics to the backtest report.  For each
trade, I want to show two things:
1) a 20-bar HHV at the date of the buy
2) a price at a certain number of bars away from the date of the buy.

So far what I have is the following (and not sure I'm on the right
track either):

if (Status("action") == actionPortfolio){
     bo=GetBacktesterObject();
     bo.Backtest(1);

for (trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade()){
             ticker=trade.Symbol();
             symbolPriceArray=Foreign(ticker, "C", 1);
             Dateoftrade=trade.EntryDateTime();
             BarNumOfTrade=....some Code Here...
             myHigh=HHV(symbolPriceArray,20)/*Also need some way to
define the
                     HHV with reference to the date of the buy*/

             CloseTenDaysAgo=symbolPriceArray[BarNumOfTrade-10];

         }

         bo.ListTrades();

}






Reply via email to