def ontrial(self, model, simulation, trial, value, engine):
        '''
            want to test some strategies for betting
            set wager for each bet
            if previous bet

            value : float
                sample from model
            
        '''
                        
        # if we lost last time then double up
        if self.previous_value == -1:
            self.wager += self.wager      
        
        # keep track of coin toss paths
        self.r[simulation,trial] = self.r[simulation,trial-1] + value
        
        # if we won, add the wager
        # else subtract the wager
        
        if self.pnl[simulation,trial-1] > 0:        
            if value == 1 :
                self.pnl[simulation,trial] = self.pnl[simulation,trial-1] + self.wager
            else:
                self.pnl[simulation,trial] = self.pnl[simulation,trial-1] - self.wager
        else:
            # no bet to be made here
            self.pnl[simulation,trial] = self.pnl[simulation,trial-1]
             
        # always reset wager    
        self.reset_wager()
        
        # keep track of the previous value for next time around
        self.previous_value = value

            want to test some strategies for betting
            set wager for each bet
            if previous bet

            value : float
                sample from model
            
        
recipes/Python/578868_Monte_Carlo_Engine__Simple_Head_Tail/recipe-578868.py