I use the concept of Historical High (HH) (i.e. 52-wk-high) in my algorithm.
This will get me that:
context.HH_FOR_THIS_CYCLE = max(price_history2[s])
However, during a longer sequence of buys, I want to hold that value and not update it constantly.
This is because in the scenario of a gradually rising market the HH continually gets reset each day/minute and you can't make a decision based on the original value.
I have already tried storing the HH and using it throughout the buy-sequence, which worked fine until I hit a stock split.
The stored HH doesn't get split and ends up being completely nonsensical relative to the new stock price.
Is there an easy way to take a stock price for a given time/date, and automatically adjust it to the (post-split-adjusted) price of a different time period?
Any alternative ways of getting to the same goal?