MACD GAP CODE(gap should be there but not closing down )

MACD code is not enough . I need the gap to be there but not closing down when I enter a trade(along with other setups) . How do I code for that?

Any help will be appreciated