[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Backtesting and Custom Metrics: How to determine HHV at date of Buy?



PureBytes Links

Trading Reference Links

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();
   
}


    
        

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___