Is there a way to store a variable or a property in memory? Or am I thinking about this all wrong?
As an example, lets say I want to buy when some indicator signals a buy - but only every other time.
I would have to track if a signal was the first or second signal observed. This would require setting and storing (past a day) a property like:
context.ready_next_time = True
then...
...
if some_signal and context.ready_next_time: # second time signal hit
order(...)
context.ready_next_time = False # reset property
elif some_signal and not context.ready_next_time : # first time signal hit
context.ready_next_time = True
The problem is when you re - initialize() everyday you clear the memory. Am I missing something is there a database or somewhere I can store data past one day?
Thanks,