LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
I'm simply trying to plot the percentage change of an asset over a given period. I'm doing this so I can workout the percentage change over a given period of time of different assets within the same plot.
I tried using the SetDataNormalization as TotalReturn but unfortunately seems like total return does something irrelevent
My workaround was to use the close price of the frst day, but that would be quite tedious if I do this for multiple assetts.
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.
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.
Yuxin Guan
1k Pro
,
Hello Hamad,
There are a few indicators that can be used to track the percentage change of an asset during a certain period of time. For example, WilliamsPercentR (WILR). I’ve also attached a backtest to shown how to plot the indicator WILR for different assets. To see the plot, check the corresponding option as shown below. Please refer to this documentation for more information about indicators and indicator-plotting.
Best,
Yuxin Guan
0
Adam W
3.8k Pro
,
def Initialize(self):
self.symbols = ['SPY', 'AAPL', ]
for symbol in self.symbols:
self.AddEquity(symbol, Resolution.Minute)
self.lastClose = {}
self.Schedule.On(self.DateRules.EveryDay('SPY'), # Change this to frequency of returns you want to plot
self.TimeRules.BeforeMarketClose(0),
self.PlotReturns)
def PlotReturns(self):
for symbol in self.symbols:
close = self.Securities[symbol].Close
# Track last closing prices
if symbol not in self.lastClose:
self.lastClose[symbol] = close
continue
# Update last close
self.lastClose[symbol] = close
0
Edited by Adam W
Yuxin Guan
1k Pro
,
Sorry the backtest is attached here.
0
Hamad Al Ali
545 Pro
,
Many thanks for the answers!!
I never got notifications for the this thread not sure why.
Once again thanks for the contribution :)
0
Derek Melchin
STAFF Pro
,
Hi Hamad,
Since you started the thread, you should be automatically subscribed to new posts. I recommend checking your spam folder.
Best, Derek Melchin
0
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.
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.
Loading...
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!