def next_calculation(self, candle):
     if self.get_datawindow() is not None:
         self.value[
             'moving_average_envelope_center'] = indicator.center_band(
                 self.get_close(), self.params['period'])[-1]
         self.value['moving_average_envelope_upper'] = indicator.upper_band(
             self.get_close(), self.params['period'],
             self.params['env_percentage'])[-1]
         self.value['moving_average_envelope_lower'] = indicator.lower_band(
             self.get_close(), self.params['period'],
             self.params['env_percentage'])[-1]
Esempio n. 2
0
 def test_center_band_invalid_period(self):
     period = 128
     with self.assertRaises(Exception) as cm:
         moving_average_envelope.center_band(self.data, period)
     expected = "Error: data_len < period"
     self.assertEqual(str(cm.exception), expected)
Esempio n. 3
0
 def test_center_band_period_6(self):
     period = 6
     cb = moving_average_envelope.center_band(self.data, period)
     np.testing.assert_array_equal(cb, self.center_band_period_6_expected)