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

Re: [amibroker] Re: problem with position and GetBacktesterObject();



PureBytes Links

Trading Reference Links



Bistrader
 
Thanks for this. I've had trouble stepping through DateTime() in CBT and using _Trace to follow what's what. This simple code helps with understanding.
Thanks!
Dave
 
----- Original Message -----
From: bistrader
Sent: Monday, September 14, 2009 8:42 AM
Subject: [amibroker] Re: problem with position and GetBacktesterObject();

 

About open positions?

SetOption("UseCustomBacktestProc", True );

barDates = DateTime();

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

for( bar = 0; bar < BarCount; bar++ )
{
barDate = barDates[bar];
OpenPos = "";
OpenPosCnt = 0;
for( pos = bo.GetFirstOpenPos(); pos; pos = bo.GetNextOpenPos() )
{
OpenPos += pos.Symbol + ",";
OpenPosCnt++;
}
_TRACE( NumToStr(barDate, formatDateTime) + " OpenPos( " + OpenPosCnt + " ):" + OpenPos );


bo.ProcessTradeSignals( bar );
}
bo.PostProcess();
}

--- In amibroker@xxxxxxxxxps.com, "raskoks" <raskoks@xxx> wrote:
>
> Hi,
> I wonder how to use
> bo = GetBacktesterObject();
> and maybe loop like this:
>
> for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )
> {
> // trade variable now holds Trade object
>
> }
>
> Too find information about current bactester position.
> I need to know for every bar information about position (long,short) because some signals shoud be use only when i have long and some for shorts.
> Maybe someone can help mi with this kind of problem.
>
> Best regards
> raskoks
>



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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





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

__,_._,___