#NEWLINE# def onBars( self , bars ) : #NEWLINE# #INDENT# dateTime = bars . getDateTime ( ) #NEWLINE# for ( meth , args , kwargs ) in strategy_test . get_by_datetime_or_date ( self . __posEntry , dateTime ) : #NEWLINE# #INDENT# if ( kwargs . __activePosition is not None ) : #NEWLINE# #INDENT# raise Exception ( 'Only one position allowed at a time' ) #NEWLINE# #UNINDENT# self . __activePosition = meth ( * args , ** kwargs ) #NEWLINE# self . positions . append ( self . __activePosition ) #NEWLINE# #UNINDENT# for ( meth , args , kwargs ) in strategy_test . get_by_datetime_or_date ( self . __posExit , dateTime ) : #NEWLINE# #INDENT# if ( self . __activePosition is None ) : #NEWLINE# #INDENT# raise Exception ( 'A position was not entered' ) #NEWLINE# #UNINDENT# meth ( self . __activePosition , * args , ** kwargs )