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.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue