The Expert Advisor increases the volume of an open position if profit in points from the last trade increases a threshold fixed in the EA inputs.
The data on addings are stored in a string comment to a position in the following format: number of addings/last trade price/last trade volume.
Trades are made when a new bar appears.
Fig. 1. Examples of trades on the chart
Translated from Russian by MetaQuotes Software Corp.
Original code: https://www.mql5.com/ru/code/16831