[amibroker] how to backtest, when I am working on last bar (barcount - 1)

 

I have a rather complicated formula that examines the price action of the past 50-100 bars and decides if I can buy/sell on the last bar (barcount-1).  One reason I work always on the last bar is to protect me from looking into the future. 

My problem is that I cannot backtest this the regular way. 

For example if I try to backtest the following, it will not examine all historical bars and signals.  It will only examine the last bar.  In the analysis window I do specify "All quotes" for the Range.

Buy=False;
Sell=False;

if( C[BarCount-1] > O[BarCount - 1] )
{
    Buy[BarCount-1] = True;
}

if( C[BarCount-1] < O[BarCount - 1] )
{
    Sell[BarCount-1]= True;
}



I might be able to get around this if I could traverse the history of bars and apply the algorithm like this:

for( virtualbarcount  = 50; virtualbarcount  <= BarCount; virtualbarcount ++ )
{
run the algorithm considering the array ends at (virtualbarcount - 1)
}


How do you guys deal with this situation?

__._,_.___

Posted by: "B. Pitatzidis" <bobptz@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
**** 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/


.

__,_._,___


EmoticonEmoticon