Weekend evening - page 27

 
Aleksandr Klapatyuk:
Thank you for being here - I'm trying to learn from your EAs how it works.

Study: Simple Expert Advisor. Bar Size Check. Buy/sell

 
Thank you very much! very useful link. would have found it sooner. Thank you!
 
Aleksandr Klapatyuk:

https://www.mql5.com/ru/code/20424 I finally found it. Thank you very much - Health and all the best!

Author of the idea: Scriptor

Author of MQL5 code: Vladimir Karputov.




I have sort of made it out of different Expert Advisors of yours - it has turned out to be interesting with trawling. - Trawls everything

Stop loss Take profit.mq5
TrendMeLeaveMe(barabashkakvn's edition).mq5
Jims Close Positions(barabashkakvn's edition).mq5
ASCV 3.mq5
Stairs.mq5
Universal 1.64(barabashkakvn's edition).mq5

From these EAs all the material is AUTO-MANUAL. Expert Advisor - CodeBase Karputov.mq5

 

Good evening. Can I write a simple EA for MT5.

The essence is as follows. When the robot enters the chart, it waits for the manually opened order. When it is detected, it sets the TP prescribed in the parameters (by a certain amount of points from the open price). Then it monitors the price. If it has not moved in our favor, at the distance specified in the parameter (points), the robot opens another order in the direction of the previous one. The profitability of a new order is increased by the coefficient specified in the parameter. Then the robot calculates the total breakeven point, adds the TP size to it and sets the TP for each order. Then the cycle repeats. The price has gone a certain distance against us and we open an order again, calculate the breakeven point for the whole grid, add the TP and set the TP for each order, and so on. At the same time, spread is also considered.

We obtain a robot that follows a manually opened trade. A simple averaging system.

 
yurabob:

Good evening. Can I write a simple EA for MT5.

The essence is as follows. When the robot enters the chart, it waits for the manually opened order. When it is detected, it sets the TP prescribed in the parameters (by a certain amount of points from the open price). Then it monitors the price. If it has not moved in our favor, at the distance specified in the parameter (points), the robot opens another order in the direction of the previous one. The profitability of a new order is increased by the coefficient specified in the parameter. Then the robot calculates the total breakeven point, adds the TP size to it and sets the TP for each order. Then the cycle repeats. The price has gone a certain distance against us and we open an order again, calculate the breakeven point for the whole grid, add the TP and set the TP for each order, and so on. At the same time, spread is also considered.

We obtain a robot that follows a manually opened trade. A simple averaging machine.

How do I set Take Profit to Breakeven level - how do I set Take Profit to Breakeven for BUY #1 position?

asdqwe

 
Vladimir Karputov:

On Take Profit at Breakeven - how do I set Take Profit at Breakeven for BUY #1?


I mean the following. I opened (or rather, I opened it manually) a Buy order at 1000. Robot sets TP = 1000 + spread + 20 (this is the TP level that I have specified in the parameters) = 1020 (I will not write about spread to avoid confusion). Then the price has moved to the level of 900 (let us assume that the distance from the previous order to open a new one I have specified is 100). The robot opens a new order. It calculates a breakeven point for both orders (let's assume that it will be at 950) and adds 20 to it, i.e. TP = 950+20=970.
 
yurabob:
What I mean is the following. A Buy order is opened (or rather, I opened it manually) at 1000. The robot sets TP = 1,000 + spread + 20 (this is the TP level that I have specified in the parameters) = 1,020 (I will not specify the spread so as not to confuse it). Then the price has moved to the level of 900 (let us assume that the distance from the previous order to open a new one I have specified is 100). The robot opens a new order. It calculates a breakeven point for both orders (let's assume that it will be at 950) and adds 20 to it, i.e. TP = 950+20=970.

I suggest one restriction: one manual position is placed on the current character. That is all. The Expert Advisor trades from here on. You cannot interfere manually any more.

 
Vladimir Karputov:

I suggest one restriction: one manual position is placed on the current character. That is all. The Expert Advisor trades from here on. No more manual intervention is allowed.

This is quite a logical idea. I need such an owl to control an open position. Sometimes I set it, and it seems to go in my direction, but it goes a little in the other direction. I work with small TPs, but I cannot always sit in front of the computer. That's why I need a safety net.
 
yurabob:
This is quite a logical idea. I need such an owl exactly for controlling an open position. Sometimes, I set it to go in my direction, but it goes a bit in the other direction. I work with small TPs, but I cannot always sit in front of the computer. That's why I need a safety net.

I suggest using theCalculation Net Price Indicator to visualize the breakeven line:

This indicator shows three lines: the net price for BUY, for SELL and the total for BUY and SELL.

An example of operation, when four BUY positions are opened first, and then one more BUY position is added:

Calculation Net Price Indicator

Although it shows three lines, but only one line - the break-even line - will be actually seen.

 
Vladimir Karputov:

I suggest using theCalculation Net Price Indicator to visualise the breakeven line:

Although it displays three lines, only one line, the breakeven line, will actually be visible.

It is up to you. I am not a programmer.