I need an MT4 EA with source code that does the following:
Send an alert from TradingView through a webhook which will be received through Telegram API and then received by MT4 and opens a trade.
The input panel of the bot should have the following inputs:
The webhook will send a message alert like this:
If anything equals 0 it is ignored.
The formula to calculate lot size is the following:
Lot Size = 1 /(SL in Points / (Capital x Risk%))
This would assume an example account of sending an alert, calculating lot size, setting a stop loss, and setting a take profit:
Lot size = 0.27
Stop Loss Set at: 1.10000
Take Profit Set at: 1.10250 to close 0.14
If breakeven is set to 1, after the first TP hit, SL should be moved to Entry Price +- 0.00005. (+ for buy trade, - for sell trade)
It should also have the ability to send a “close alert” message:
close_%. In which case it would close only a specified % of the current open position. A close alert should also move SL to Entry Price +- 0.00005.
If there is a Buy Trade open, and a Sell Trade Alert happens, it must completely close the Buy Trade, leave a small delay so it can read the new balance and then process to calculate Lot Size the same way. Same thing for the opposite situation.