I was going through this algorithm from the docs and I quite understand it but theres something that I cant just get my head around. When it says

 

'''
Enter or exit positions based on relationship of the open price of the current bar and the prices defined by the machine learning model.
Liquidate if the open price is below the sell price and buy if the open price is above the buy price
'''
for holding in self.Portfolio.Values:
if self.CurrentSlice[holding.Symbol].Open < self.sell_prices[holding.Symbol] and holding.Invested:
self.Liquidate(holding.Symbol)

if self.CurrentSlice[holding.Symbol].Open > self.buy_prices[holding.Symbol] and not holding.Invested:
self.SetHoldings(holding.Symbol, 1 / len(self.symbols))

Shouldnt that be the orthe way around? I mean, how is buying an asset once it reached a certain price profitable? What am I not getting?

Thanks for your help!