Sorry,

I meant this:

< snip>
for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())


{ 

value_all_open_pos=value_all_open_pos + trade.GetPrice(i, "C") * trade.shares - 
trade.marginloan; // I use margin in my system

}


my_equity [i] = value_all_open_pos + bo.cash;

value_all_open_pos=0; // resetting to zero for next run - necessary?

bo.UpdateStats(i, 1); 

bo.UpdateStats(i, 2);

} // End of for loop over bars

bo.PostProcess();

AddToComposite(my_equity, "~~~My_Equity","x", 1+2+8+16+32+64+128); 

}


  ----- Original Message ----- 
  From: Markus Witzler 
  To: [email protected] 
  Sent: Tuesday, January 05, 2010 11:56 PM
  Subject: [amibroker] Trade.marginloan in custom backtester


    

  Hello,

  does anybody know if trade.marginloan also works for open positions?

  I want to use it like this

  < snip>
  for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())


  { 

  value_all_open_pos=value_all_open_pos + trade.GetPrice(i, "C") * 
trade.shares; 

  }


  my_equity [i] = value_all_open_pos + bo.cash - trade.marginloan; // I use 
margin in my system

  value_all_open_pos=0; // resetting to zero for next run - necessary?

  bo.UpdateStats(i, 1); 

  bo.UpdateStats(i, 2);

  } // End of for loop over bars

  bo.PostProcess();

  AddToComposite(my_equity, "~~~My_Equity","x", 1+2+8+16+32+64+128); 

  }

  For some reason, my_equity is higher if I use " minus trade.marginloan" (see 
above) than if I skip it. This is awkward...

  Thanks

  Markus


  

  __________ Information from ESET Smart Security, version of virus signature 
database 4668 (20091207) __________

  The message was checked by ESET Smart Security.

  http://www.eset.com

Reply via email to