How to record a trade direction

I want to ensure that I only signal a trade, if it is in the opposite direction to the last trade signaled. e.g. A long trade can only follow a short trade. Is there a way I can use a variable to record the last trade direction in order that I can add this as a condition to the current trade signal? Or is there another way to achieve this? Thanks

You can use ExRem() function:

1 Like

Hi - Thanks for the response. The scenario is where my signals trigger to go short and then cover, but then the MA's cross short again and signal to go short. I don't want them to trigger until there has been a buy and then sell signal first - I'm not sure how exrem can help on this - see screenshot below.



Buy = ExRem(Buy,Short);
Short = ExRem(Short, Buy);
Sell = ....
Cover = ...

it works a treat - Thanks