Robot with dynamic grid where orders follow the price
-
How can I create a robot whose grid works as follows: after the first order is opened, whether it is a buy or sell order, when the price advances, the second buy or sell order follows the price. If, for example, the price advances 100 pips, the second buy or sell order follows it, as if it were a trailing stop. If the price returns, for example, 50 pips, the second buy or sell order is initiated.
-
I'm not sure I fully understand. What do you exactly mean by 'follows the price' when apparently the trade is open in a pull back?
-
Here is an example: the first order was opened, I would like the entry of the second order to follow the price so that if the price went back, for example, 50 pips, the second order would be triggered
-

-
From the second entry onwards, I am using these codes
-
-

-
Your logic is correct as far as you are using a negative number on that Constant. That means prce now is in loss that distance in respect of the last open trade.