How to start with MQL5 - page 19

 
RZAMK :

thank you.

But you brought this code in previous pages.

Oh, maybe I didnt fully explain what I meant. I dont search the history for closed positions.

I want to find the openprice of the last position that is still open and take another position or positions according to its price.

I have provided a code that will work for the DEAL type - "ENTER THE MARKET". There is no closure.

 
Vladimir Karputov:

I have provided a code that will work for the DEAL type - "ENTER THE MARKET". There is no closure.

Dear Sir,

These are pictures of my EA on MT4 and MT5.

Problem is : I can only have one position on MT5, while I want to open other positions step by step at the same time by moving the price away from this position as much as X pips.

Thanx for help.

Files:
MT4.gif  1562 kb
MT5.gif  1816 kb
Ss.mq5  21 kb
 
RZAMK :
Dear Sir,

These are pictures of my EA on MT4 and MT5.

Problem is : I can only have one position on MT5, while I want to open other positions step by step at the same time by moving the price away from this position as much as X pips.

Thanx for help.

Your images are of very low quality and low resolution. I still cannot understand what you are asking me about.

 
Vladimir Karputov:

Your images are of very low quality and low resolution. I still cannot understand what you are asking me about.

Sorry, these are better.
Files:
MT4.zip  1278 kb
MT5.zip  1052 kb
 
RZAMK :
Sorry, these are better.

I understood you. So, based on We catch the transaction, we make an advisor: it will open a position every N-points ...

The code will be a bit later.

How to start with MQL5
How to start with MQL5
  • 2021.02.28
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 
RZAMK :
Sorry, these are better.

And here there are two questions at once: by condition We want to open a new BUY position every 70 points. Let's say we started trading and opened a BUY position. The BUY position passed 50 points and closed when the Take Profit was triggered. What to do? Open a new BUY position immediately?

 
Vladimir Karputov:

And here there are two questions at once: by condition We want to open a new BUY position every 70 points. Let's say we started trading and opened a BUY position. The BUY position passed 50 points and closed when the Take Profit was triggered. What to do? Open a new BUY position immediately?

No, No, Man.

Please clear your mind from TP and SL numbers. They were just examples in film and EA.

I want to open one position with increase the price,  as much as each X points (for example, every 100 Points) and also keep other positions until the price reaches a certain level and close all at once.


I have two problems here :

First, I can't have multiple open positions at the same time.

And second, I do not know how to get OpenPrice of existing position, to open another position if the price moves away from that X Points.

Files:
Untitled.jpg  119 kb
 
RZAMK :

***

First, I can't have multiple open positions at the same time.

***

First, decide what type of your trading account: netting or hedging.

 
Vladimir Karputov:

First, decide what type of your trading account: netting or hedging.

If I understand what you mean by netting correctly, of course I want netting.

Mr Vladimir,
Is it possible in MQL5 to have for example two 0.01 lot buy positions and three 0.01 lot sell positions simultaneously but independently at 100 points intervals in a price range such as 500 points?

 
RZAMK :

If I understand what you mean by netting correctly, of course I want netting.

Mr Vladimir,
Is it possible in MQL5 to have for example two 0.01 lot buy positions and three 0.01 lot sell positions simultaneously but independently at 100 points intervals in a price range such as 500 points?

No, you did not understand me. I asked: "What type of your TRADING ACCOUNT: netting and hedge"?

Reason: