In foreign exchange trading, the most important investment principle is to ensure the safety of the principal, and risk prevention and control is the primary operation concept.
How to manage the account funds is to control the position size and the profit and loss of the order, this EA is designed based on this idea.
It can directly manage the risk control of the trading account and realize two functions.
One is to close the position according to the profit and loss ratio, and the other is to automatically set the profit and loss points for the newly opened position, which is suitable for all the currency pairs.
Input bool closepointmode = 0; / / close by points switch: 0, close; 1, open
Input int stoploss= 500; / / stop loss points
Input int takeprofit = 600; / / number of earnings stop points
Input bool closeratemode = 0; / / proportional position closing switch: 0, off; 1, on
Input double lossrate = 0.5; / / loss closing proportion
Input double profitrate = 0.3; / / profit closing ratio
Input int trailingstop = 0; / / start tracking stop points after profit making: 0, do not track; > 0, track, for example, 100, start to move stop points point by point after profit making, only forward and not backward