INNER CODE UNIT · Python

_update_plot_candles_list

Erfaniaa/crypto-trading-strategy-backtester · backtester.py:348

	def _update_plot_candles_list(self):
		is_ontime = False
		if self.open_position_timeframe == "m15":
			is_ontime = self.current_candle.open_time == utils.round_down_m1_to_m15_time(self.current_candle.open_time)
		if self.open_position_timeframe == "h1":
			is_ontime = self.current_candle.open_time == utils.round_down_m1_to_h1_time(self.current_candle.open_time)
		if self.open_position_timeframe == "h2":
			is_ontime = self.current_candle.open_time == utils.round_down_m1_to_h2_time(self.current_candle.open_time)
		if self.open_position_timeframe == "h4":
			is_ontime = self.current_candle.open_time == utils.round_down_m1_to_h4_time(self.current_candle.open_time)
		if self.open_position_timeframe == "d1":
			is_ontime = self.current_candle.open_time == utils.round_down_m1_to_d1_time(self.current_candle.open_time)
		if is_ontime:
			candle = self._get_current_candle_in_another_timeframe(timeframe=self.open_position_timeframe, index_offset=0)
			self.plot_candles_list.append(candle)
			if self.last_position_status == self.NO_POSITION:
				if candle.close >= candle.open:
					self.plot_candle_colors_list.append("white")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…