You need to set a variable when you either go LONG or SHORT, so that it will later let you know if the last trade was going northwards or southwards. If trades are open not so frequently you might decide to reset the variable to ZERO after “n” candlesticks have elapsed. It’s up to you.
I am using a solution like the above which works fine for last trade direction but not if the trade opens and closes within the same bar. In that circumstance the variable does not change because we are Not OnMarket at the close of the bar.
I have tried various solutions but just can’t seem to nail it.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok