INNER CODE UNIT · Python
_update_candles_statistics
Erfaniaa/crypto-trading-strategy-backtester · backtester.py:132
def _update_candles_statistics(self):
self.candles_open_to_close_list.append(self.current_candle.close - self.current_candle.open)
self.candles_open_to_close_abs_list.append(abs(self.current_candle.close - self.current_candle.open))
self.candles_open_to_close_random_signed_list.append(random.randint(-1, 1) * abs(self.current_candle.close - self.current_candle.open))
self.candles_open_to_low_list.append(self.current_candle.low - self.current_candle.open)
self.candles_open_to_high_list.append(self.current_candle.high - self.current_candle.open)
self.candles_low_to_high_list.append(self.current_candle.high - self.current_candle.low)
self.candles_low_and_high_to_open_list.append(self.current_candle.low - self.current_candle.open)
self.candles_low_and_high_to_open_list.append(self.current_candle.high - self.current_candle.open)
self.candles_low_and_high_to_open_abs_list.append(abs(self.current_candle.low - self.current_candle.open))
self.candles_low_and_high_to_open_abs_list.append(abs(self.current_candle.high - self.current_candle.open))
self.candles_open_to_close_percent_list.append(100 * (self.current_candle.close - self.current_candle.open) / self.current_candle.open)
self.candles_open_to_close_abs_percent_list.append(100 * abs(self.current_candle.close - self.current_candle.open) / self.current_candle.open)
self.candles_open_to_close_random_signed_percent_list.append(random.randint(-1, 1) * 100 * abs(self.current_candle.close - self.current_candle.open) / self.current_candle.open)
self.candles_open_to_low_percent_list.append(100 * (self.current_candle.low - self.current_candle.open) / self.current_candle.open)
self.candles_open_to_high_percent_list.append(100 * (self.current_candle.high - self.current_candle.open) / self.current_candle.open)
self.candles_low_to_high_percent_list.append(100 * (self.current_candle.high - self.current_candle.low) / self.current_candle.low)