| 
 PureBytes Links 
Trading Reference Links 
 | 
  
You are using Low level there, and in my understanding you have to code
yourself checks for available funds. That's maybe why your equity goes
below 0. 
 
 
Here is what I use to set margin deposit: 
 
 
SetOption( "UseCustomBacktestProc", 1);
 
 
if ( Status( "action" ) == actionPortfolio )
 
{
 
 
    bo = GetBacktesterObject();
 
    bo.preProcess();
     
    for
( bar = 0;
bar < BarCount; bar ++ )
 
    {
 
 
        for ( sig = bo.GetFirstSignal( bar ); sig ; sig =
bo.GetNextSignal( bar ) )
 
        {
           
            sig.margindeposit = sig.price * sig.pointvalue / 100;
 
 
        }
 
 
        bo.ProcessTradeSignals( bar );
 
    }
 
 
    bo.postProcess();
 
 
}
 
 
 
 
On 2/2/2010 8:40 PM, İlhan Ketrez wrote:
  
  
One reason is to trace bo.Cash for example. 
   
  2010/2/2 Aron  <aron.groups@xxxxxxxxx>
  
     
    
    
    
    Why did you use custom backtester ?  
    
    
    
    
    
On 2/2/2010 6:37 PM, İlhan Ketrez wrote:
     Hello, 
       
I am a registered user of Amibroker and have sent this problem to
Amibroker support before sending to the mailgroup. 
By now, more than one week has passed and there is no reply. 
       
I still do not want to believe that Amibroker cannot perform a correct
futures/forex bactest and I am afraid of hearing that it can't.
However, to me, my tests clearly indicate that there's something wrong
with the default behaviour of "futures mode" backtesting. Shortly, you
open a position, and as the position be exhausted you still have cash
in your account. Even after the position size goes below zero, you
still have cash and may open a position if you code accordingly.
Ability of the position size to go below zero may just be another
discussion topic. There is no such account in real life. Normally, the
position size does not change if the position is a winner and if the
position is a loser, it consumes the cash first, then consumes itself
down to the maintenance margin where the broker liquidates the position. 
       
All in all, my request from Amibroker stuff is to either invalidate my comments by
writing a few sentences or clearly accept that Amibroker cannot
perform a correct futures backtest and stop misleading
people.  
       
Best regards, 
Ilhan 
       
       
      2010/1/28 İlhan Ketrez  <ketrezilhan@xxxxxxxxx>
      
         
        
        
        [Attachment(s) from =?UTF-8?Q?=C4=B0lhan_Ketrez?=
included below]
        Dear friends 
         
        I am trying to
test a simple system and understand the behaviour of Amibroker testing
mechanism. 
        I have set up an
AFL file very similar to the one described here. 
         
        Testing period:
01.01.2008 - today 
        Initial equity:
1,000,000 
        Final equity: -38,033,810 
         
         
The position size is -80. 
Margin deposit: 1000. 
First entry details are as follows: 
Contract number is 800 
Entry position size: 800,000. Cash: 200,000. 
         
The details I find interesting are: 
As the position grows position size also grows and cash continues as
200,000. 
Later, position size goes below zero as cash floats constantly above
zero. 
The default result in Amibroker is something impossible to encounter in
real life. (To go into a debt of 38 million) 
I defined a real cash value and observed the difference via debugview.  
         
         
        Report and
debugview log are attached including the system codes. 
         
I hope to find a way to test correctly using Amibroker with your help. 
Thank you very much in advance. 
         
Regards, 
Ilhan Ketrez 
         
         
         
         
         
       
       
       
     
    
     
     
     
     
     
     
   
   
   
  
 
 
 
    
    
 
__._,_.___
  
**** 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/ 
 
  
     
    
 
      
   
__,_._,___
 |   
 |