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

[amibroker] Re: Max simultaneous open positions



PureBytes Links

Trading Reference Links

A DateTime version, which theoretically could work for intraday bars....

  // finish backtester up here

  // CALCULATE CUSTOM METRICS

  dt = DateTime();

  // simultaneous open trades
  // intensive, takes more time than the backtest and postprocess
  sot = 0;
  for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )
  {
    tedt = trade.EntryDateTime;
    txdt = trade.ExitDateTime;
    sot = IIf( ( tedt <= dt ) AND ( txdt >= dt ), sot + 1, sot );
    hsot = LastValue( Highest( sot ) );
  } // for trade


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.14/637 - Release Date: 1/18/2007 1:03 PM