EA with Panel that uses Telegram Messages To Trade with specific conditions and risk management

2020.05.05 Experts Integration

Specification

Requirements for an Expert Advisor that reads messages from a Telegram group and place trades according to it:

 - The EA basically needs to read messages containing trading instructions during the day that are posted in a Telegram group, 
and place market orders, stop or limit orders according to it, and manage the open trades according to more messages that arrives during the day, saying to add average orders, add breakeven, take profit, stop gain, stop loss and close the order. If it does not identify a TP, SL or another needed condition, it will set the standard inputs set by the user on it.
This may be performed in a hedge account type, so please leave to option to work with multiple positions, because we will have averaging.
Another requirement are that the Take Profits shall be Limit Orders, to avoid slippage. If using hedge account option, then the EA will use the Close By function to close the orders in case the TP is hit.
 - I will be trading at a local centralized exchange in my country, and the messages are in local language, but don´t worry. The user will type in the EA settings what are the possible words for each function.
I´ll type below some examples of words and combination of words to look for. It can be changed, reduced or added by the user of course:

 - The key combination of words that it needs to read on the message to understand what it has to do are:
1 - If it reads "compra" and "mercado", or "alta" and "mercado", it means "buy" and "market", so the EA must place a Buy trade at market 
(These words can be separated with another words in the middle, so the EA can ignore words that it does not recognize on each line, but usually they don´t mean any extra thing).

1.1 - In this same message, or the next one, it also usually says the size of the Take Profit which could be for example: "50" and "pontos" (or just "50" alone, without saying "pontos", the user can set if it is a combination of words or just one, and they may not be in a sequence), which means "50" and "points" in this case. 
TP for Market Orders are usually 100 points if it is not stated. But if it is stated, then the EA, after identifying the "compra" and "mercado", it shall look for the TP by searching for a number with 2 or 3 digits maximum, followed by the word "pontos" or not.
The message may have the word "ganho", "lucro" or "gain" (gain in English too) after the "50 pontos" for example. So this can be left as an option for the user to define if the EA shall also look for the word "gain" or not to identify the TP.
If the EA cannot find the TP, or if the user chooses not to find a TP for this type of order, then it can use a standard TP for market orders set by the user.

2 - If it reads "venda" and "mercado", or "queda" and "mercado", it means "sell" and "market", so the EA must place a Sell trade at market 
(These words can be separated with another words in the middle, but usually they doné mean any extra thing).

2.1 - In this same message, or the next one, it also usually says the size of the Take Profit and for example "50" and "pontos" (may not be in a sequence), which means "50" and "points" in this case. 
TP for Market Orders are 50 points if it is not stated. But if it is stated, then the EA, after identifying the "venda" and "mercado", 
it shall look for the TP by searching for a number with 2 or 3 digits maximum, followed by the word "pontos" or whatever word is set by the user.
The message may have the word "ganho", "lucro" or "gain" (gain in English too) after the "50 pontos" for example. So this can be left as an option for the user to define if the EA shall also look for the word "gain" or not to identiry the TP.
If the EA cannot find the TP, or if the user chooses not to find a TP for this type of order, then it can use a standard TP for market orders set by the user.


3 - If the message says "compra" (buy) or "venda" (sell) and then a 4 or 5 digit number (it can have another words between them) and/or says "start" or "limite", it means to place a trade at an specific price point. 
In this case we can have 4 scenarios that I will show as examples below:
   "compra" or "alta" (buy) and a number as "100200", considering as an example that the current price of the asset is 100000. So this will mean that the EA needs to place a Buy Stop Order at the price of 100200.
   "compra" or "alta" (buy) and a number as "98800", considering as an example that the current price of the asset is 100000. So this will mean that the EA needs to place a Buy Limit Order at the price of 98800.
   "venda" or "queda" (sell) and a number as "100200", considering as an example that the current price of the asset is 100000. So this will mean that the EA needs to place a Sell Limit Order at the price of 100200.
   "venda" or "queda" (buy) and a number as "98800", considering as an example that the current price of the asset is 100000. So this will mean that the EA needs to place a Sell Stop Order at the price of 98800.
3.1 - If one of the conditions above happens, then the EA after opening one of the types above, shall look at the same message, or next one, for the gain or stop loss.
3.1.1 - The gain can be identified in the case by the word "gain", "ganho" or "lucro" or whatsoever the user wants and a quantity of points "for example, 500" or a 4 or 5 digit number, stating where the TP will be located. 
The user can also have the option to manually set a gain in points for this type of order.
If the EA does not find a 4 or 5 digit number, but a 2 or 3 digit number, than that will be the number of points for the gain from the order opening price, obeying the same condition as itens 1.1 and 2.1 above.
3.1.2 - The stop loss can be identified in the case by the word "stop" and a 4 or 5 digit number, stating where the SL will be located. 
If the EA does not find a 4 or 5 digit number, but a 2 or 3 digit number, than that will be the number of points for the SL from the order opening price, obeying the same condition as itens 1.1 and 2.1 above.
The user can also have the option to set a Stop Loss in points for this type of order.

4 - Trading on Market Auction: The EA can also trade just right after the Market Auction, when it opens everyday. The Market Auction starts at 8:55 and we will have a bid>ask condition. The Auction can go on until 
the price is defined (usually at 9:00~9:05 server time). So while bid>ask, we can received messages that will say if we must buy ("compra" ou "alta") or if we must sell ("venda" or "queda"), but no order shall be placed until the auction is over (bid<ask) and the trading starts.
In this case we will trade market orders only. Take Profit is usually set at 125 points (or set by the user).
and the Stop Loss at 250 points (or set by the user).
4.1 - During the Auction or just after it happened, we may receive messages with the word "arrastar" (slide or move in English) ou "arrasta" ou "arraste" and a 4 o 5 digit number, which will mean that the EA needs to
move the current buy limit or sell limit order to that new position. The TP and SL will move along too as expected.


In sum, there are basically 3 important features:


1 - Leave an option for the user to change the words the EA needs to read for each type of trade function, 
in a field and separated by comma or another sign. For example, for the function of buy at market order, 
we have "compra" and "mercado", so in this field we would have compra;mercado;.
But if the user wants it can change the words to look for, add or reduce the number of words to look for. 
For example, he could change to "alta" and "agora" by typing alta;agora; or add a third word to look for, 

like alta;mercado;agora;. The user needs to be free to set the words he wants the program to look for all the types of operation above.

2 - We must have a Panel to support the user on ths risk management settings and trade settings. In this panel he needs to see and be able to modify:

2.1- Size of Standard TP;

2.2- Size of Standard SL;

2.3 - Risk Size of the trade, with 3 options:

2.3.1 - Set by an amount of money for a defined TP. In this case the Lot/Contract size is calculated according to the TP size and the amount of money the user wants to win. For example, if the TP is 100 points, and the contract value of each tick/point is 0.2 USD, and the user wants to win 100 USD in case it hits the TP, then the EA calculates 100 USD / (100 pt x 0.2) = 5 Lot/Contracts for the next trade.

2.3.2 - Set by an amount of money for a defined SL. In this case the Lot/Contract size is calculated according to the SL size and the amount of money the user wants to win. For example, if the SL is 500 points, and the contract value of each tick/point is 0.2 USD, and the user wants to lose nor more than 100 USD for each trade single in case it hits the SL, then the EA calculates 100 USD / (500 pt x 0.2) = 1 Lot/Contracts for the next trade.

2.3.3 - Set just by a single Lot/Contract for any position, entered by the user.

2.4 - Result in money of Todays Trades;

2.5 - Result in money for this week Trades;

2.6 - Result in money for this month Trades;

2.7 - Daily profit target set in money, which after it reachs the EA stops trading for the day.

2.8 - Daily loss tardet set in money, which after it reachs the EA stops trading for the day.

2.9 - Trailing Start: Define a trailing start point, which after the EA will move the SL of the order according to it. If more orders are opened due to averaging, the EA will use the average price of all positions accordingly.

2.10- Trailing Stop: Define the price of the trailed SL from the current price to move. If more orders are opened due to averaging, the EA will use the average price of all positions accordingly.



3 - Option to request confirmation of the user before placing any trade. So in case there is a new Telegram message with a signal, the EA will open a pop-up with the signal information it was able to detect, and asking if the user wants to proceed and open the trade. It also have an option to send a push notification for each pop-up opened, or action done by the EA, and the result of a trade/trades when it is closed.



How to do the averaging:


   - If we have an open order, and a new message is received with a "compra" (buy) or "venda" (sell) and the word "mercado" (market) or the word "mais" (more), 
it means an instruction to open another order of the same type of the current order, averaging the position. Up to 6 can be opened (it can be set by the user).
So after receiving instructions to open a buy or sell averaging order at market, the EA must calculate the average position, and correct the TPs and SLs of the opened orders according to it.
The TP can also change if an order starts to be averaged, so in case in same message that opened the averaging order, or the next message, it shows a 2 or 3 digit number and the word "gain", "ganho" or just a 2 or 3 digit number like "50" or "100", 
then the TPs can be set to this new instructed position. The averaging TPs can also be set by the user. The user can set if SL will be recalculated considering all opened positions, setting a new SL for the average position, or if it will keep the old SL for all new opened positions.


Other words that may appear on new messages that will also cause actions in the EA:

   - If the EA reads the word "Stopou" in a new message, it means that the trade (and averaging trades) were closed with a stop loss. If the current trade wasn´t already closed or reached the stop loss, 
the EA can close the order and averaging orders immediately after reading the word "Stopou". this word can be set by the user.
   - If the EA reads the word "gain" or another word set by the user alone in a new message, it means that the trade (and averaging trades) were closed with a gain. 
If the current trade wasn´t already closed or reached the take profit, the EA can close the order and averaging orders immediately after reading the "gain" words above.
   - if the EA reads the word "stop gain" or "0x0" or "0 x 0", it means that the EA will need to set a break even on the current trade or averaging position trades. 
The trigger to set the breakeven in points, if the EA read one of the words above, can be set by the User, and the breakeven position can be 5 points or set by user as well.


That´s it. I tried my best to explain it all so it got a little big in text, but it is simple EA. Please fell free to ask for any clarification. Thanks!

Responded

1
Developer 1
2020.05.05
Rating
4.72
(47)
Projects
75
9%
Arbitration
26
15% / 23%
Overdue
5
7%
Working
2
Developer 2
2020.05.05
Rating
4.93
(70)
Projects
83
40%
Arbitration
0
Overdue
2
2%
Free
3
Developer 3
2020.05.05
Rating
5
(9)
Projects
10
20%
Arbitration
1
0% / 100%
Overdue
4
40%
Working

Project information

Budget
72+ USD
For the developer
64.8 USD

Customer

Placed orders6
Arbitrage count1