Hi I am trying to write a expert advisor code that will open a new trade in the same direction as the previous if it was profitable and change direction if it was not. Any ideas on how to do this? Thanks