Simple idea: if the price and volume move in the same direction, the market is bullish; otherwise the market is bearish. Therefore, we should buy when both price and volume are increasing and sell when both are decreasing.
Implementation is also intuitive, except for the fact that there is no "open_volume" parameter so we need to set a global variable to store the values of trading volumes.
Note the risk performance is not bad for this algo.