How to randomise EA take profit points?

Is it possible to code an ea to take profits lets say 30 pips, 50 pips and 150 pips. For example, on today’s trade, the ea takes profit at 30 pips, next trade, take profit at 50 pips and the next, 150 pips. Not necessarily in the same order but simply avoiding a single tp value. Anyone can give me an idea e.g using random numbers to sort this problem ? In other words , can you randomize the input TP values?


No need for setting TP levels at the broker. Have your EA monitor the levels at which you want to take profit.

On a netting account, you simply place an order in the opposite direction as your current position for a lot size smaller than the whole amount.

So, if you have a LONG position of 1.00 lot:

  • When you hit 30 pips, place a SHORT order of 0.35 lots.
  • When your position hits another 50 pips, place a SHORT order of 0.35.
  • When your position hits 150 pips, close the position, which should be at 0.30 lots.

If you want to randomize, use MathRand() to choose the 30, 50, 150 . . . but I guess that assumes you already have an algorithm of where you think the maximum TP would be.

yes you can randomize TP values, do you REALLY need help for that?