Stock Buy Sell Position Indicator

Asked at Hudson River Trading · Coding Questions · Difficulty: Medium

Given a sequence of integer prices, decide when to buy and sell by identifying special sequences of price movements called **indicators**. Represent a price increase as `1` and a price decrease as `-1`. For example `buyIndicator = [1, 1]` means buy after two consecutive increases; `sellIndicator = [-1, -1, 1]` means sell after two decreases then an increase.

Loading the problem…