For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
how efficient to compare one Indicator base on multi datafeed
-
if I have 2 data feeds, google and facebook.
self.google_pct = bt.indicators.RateOfChange(self.datas[0].close, period=1) self.facebook_pct = bt.indicators.RateOfChange(self.datas[1].close, period=1)
what I want to do is to buy which has bigger pct. like below
if self.google_pct[0] > self.facebook_pct[0]: buy google else: buy facebook
if there are n data feeds, what's the efficient way to find the data feed with max pct?
-
add more comment to make my question clear.
what I want to do is compare multi Indicator to get max one
self.one_pct = bt.indicators.RateOfChange(self.datas[0].close, period=1) self.two_pct = bt.indicators.RateOfChange(self.datas[1].close, period=1) self.three_pct = bt.indicators.RateOfChange(self.datas[2].close, period=1) ..... self.n_pct = bt.indicators.RateOfChange(self.datas[n-1].close, period=1)
what I want to do is find the max one and buy like below
max_stock=findMaxpct() self.buy(data=max_stock)
how to implement the find_max_pct efficient?