@ravivzada
you just used the half of my solution.
first you have to check if it is a buy or sell trade
then you would have to decide if you want to use just completed bars or not
depending on this decision you have to check if the last bar ha close > open = bull bar and if current bar ha close < open = bear / which means close buy trades and vice versa for sell trades