'Pine Script - Multiple Conditions in few bars

I have 3 conditions that needed for entry. But they can be met in 4 bars. I use MACD, stochastic and RSI. For example, in first bar there is macd lines cross, after that stochastic cross in the next bar and after rsi cross 50. And all that conditions happened in 3 bars. Can you help me what function I can use there please?

if (crossover(macd, signal) and crossover(k, d) and crossover(vrsi, 50))
     strategy.entry("Long", strategy.long)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source