Hi,
How would I create a 7 days low for the 7 preceding days to today (so todays price is excluded from the low calculation).
For example:
day, low
T-7 54
T-6 56
T-5 52
T-4 61
T-3 62
T-2 64
T-1 63
Today 51
In this example the value of 52 is required.
The low for the preceding 7 days is 52 - I do not want to include today's price (51) in the calculation.
I have used:
hist = self.History(self.spy,timedelta(7), Resolution.Daily)
low=min(hist("low")
But the close price for today never breaks the low suggesting to me that today is included in the calculation when I would like it excluded.
Any help would be very welcome
Thanks
Simon
Fred Painchaud
Hi Simon,
Have you looked at
Especially Minimum.
If you want to compare the current low with a number of the previous ones, don't add the current one in your indie before comparing. Compare, then act, then add the current low to the indie so next time, you compare the new current with the previous ones.
Fred
Simon Coleman
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!