|  | @@ -131,7 +131,6 @@ class TestStrategy(bt.Strategy):
 | 
	
		
			
				|  |  |          # and (self.net_pct_l[0] > 10) and (self.net_pct_xl[0] > 3)  \
 | 
	
		
			
				|  |  |          # and (self.net_amount_main[-1] > 0) and (self.net_amount_main[0] > 0)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          if len(self) > self.params.num:
 | 
	
		
			
				|  |  |              vola = self.params.Volatility / 100
 | 
	
		
			
				|  |  |              rate = self.params.rate / 100
 | 
	
	
		
			
				|  | @@ -144,8 +143,13 @@ class TestStrategy(bt.Strategy):
 | 
	
		
			
				|  |  |                      (lowest * (1 - vola)) < self.low[-1] < (lowest * (1 + vola)))) \
 | 
	
		
			
				|  |  |                      and self.volume[0] >= self.volume[-1] and self.dataclose[0] > self.dataopen[0] \
 | 
	
		
			
				|  |  |                      and self.sma5[0] < self.sma10[0] and self.sma10[0] > self.sma20[0]:
 | 
	
		
			
				|  |  | -                self.order = self.buy()
 | 
	
		
			
				|  |  | -                self.pos_price = self.low[-1]
 | 
	
		
			
				|  |  | +                while True:
 | 
	
		
			
				|  |  | +                    m = -3
 | 
	
		
			
				|  |  | +                    if (self.hl[m] == 2 or self.hl[m] == 1) and self.macd[m] < self.macd[-1] and self.dataclose[m] > self.dataclose[-1]:
 | 
	
		
			
				|  |  | +                        self.order = self.buy()
 | 
	
		
			
				|  |  | +                        self.pos_price = self.low[-1]
 | 
	
		
			
				|  |  | +                        break
 | 
	
		
			
				|  |  | +                    m -= 1
 | 
	
		
			
				|  |  |              elif ((self.hl[0] == 5 or self.dataclose[0] < self.sma5[0]) and ((highest * (1 - vola)) < self.high[-2] < (highest * (1 + vola)))) \
 | 
	
		
			
				|  |  |                      or self.dataclose[0] < self.pos_price:
 | 
	
		
			
				|  |  |                  self.order = self.close()
 |