take profit %
-
hello, when my EA open a new trade, I would like to put the take profit as a % of the open price of the trade. For example, if the EA open a long position on German index at the price of 11000 I want that my EA set the take profit at 5% of open price (550 pips of profit and then the take profit will be 11550 ).
In the settings I found only the possibility to set the take profit as a % of the stop loss but it's not what I need.
Can sombody help me to program it? -
You can setup a Formula: Open price x 0,05. Be careful to set up correctly pips or digits.
-
Or you can put any calculation using native MQL4 functions here: http://prntscr.com/7hkq7t
Because not everything in MQL4 is hard to do. For example, the Ask price can be get by simply writing Ask. Ask is predefined variable. Also Bid.
http://docs.mql4.com/predefined/ask
Some account data is also easy, for example AccountBalance() is giving us the current balance: http://docs.mql4.com/account/accountbalance