You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I would need to specify not only the direct strategy for buying/selling, but also evaluate whether when a specific condition arise that day belongs to one of preset date ranges.
Something like this:
df = pd.read_csv('data.csv')
# column 'Date' example '2023-05-06 00:00:00'
... Range1 = between 2023-01-01 and 2023-01-10
... Range2 = between 2023-01-21 and 2023-01-20
... Range3 = between 2023-02-01 and 2023-02-10
class Test(Strategy):
...
def next(self):
if crossover(self.testA1, self.testA2) and ... 'Date' within Range1 or Range2 or Range3
self.position.close()
self.buy()
elif crossover(self.testB1, self.testB2) and ... 'Date' NOT within Range1 or Range2 or Range3
self.position.close()
self.buy()
elif ...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I would need to specify not only the direct strategy for buying/selling, but also evaluate whether when a specific condition arise that day belongs to one of preset date ranges.
Something like this:
Thank you
Beta Was this translation helpful? Give feedback.
All reactions