In commodities like oil and gas the market loves to squeeze users who enter a short or long because RSI passes a certain threshold, because as an indicator it leads to many jumping the gun, while MACD is too much of a lag.
Is there a way to code to not just measure RSI going above a level, but put an optimised condition of how long above that level it stays before entering a short or long. (Not the frequency it hits the level)