I would like to buy a contract after the first contract is x bars old and negative. So that I would have 2 contract in total. And after that, if the cumulated contracts are positive (lets say 10 pips), the system should sell them both.
This should do what you want. Difficult to tell from the description whether you want to stop trading at two positions or not. This code will just keep on buying.
There are benefits and disadvantages to this. Less trades = less exposure but you may miss trades right at the bottom of the market meaning that price has to climb further before you are in profit.
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.