Import where() directly instead of importing the entire numpy package in RSI 25 / 75 strategy
This commit is contained in:
parent
c24554a725
commit
21cacfaf0c
@ -1,5 +1,4 @@
|
|||||||
import numpy as np
|
from numpy import where
|
||||||
|
|
||||||
from pandas import DataFrame, Series
|
from pandas import DataFrame, Series
|
||||||
|
|
||||||
from indicators import sma, rsi
|
from indicators import sma, rsi
|
||||||
@ -17,4 +16,4 @@ def rsi_25_75(data: DataFrame) -> Series:
|
|||||||
rsi_below_25 = rsi_4 < 25
|
rsi_below_25 = rsi_4 < 25
|
||||||
|
|
||||||
conditions = above_ma_200 & rsi_below_25
|
conditions = above_ma_200 & rsi_below_25
|
||||||
return Series(np.where(conditions, 'L', 'N'), index = data.index)
|
return Series(where(conditions, 'L', 'N'), index = data.index)
|
Loading…
Reference in New Issue
Block a user