Questions from Beginners MQL5 MT5 MetaTrader 5 - page 925

 
Alexey Viktorov:

I mean, the position exists or not...

It's easy to write such a thing. You just select trades belonging to the position and go through them in the loop and add up the profit, swap and commission.

And what about reopening in the futures market, for example? Pos_id changes, as far as I remember. When you reverse Pos_id remains the same, at least it used to, I don't know how it is now.

 

Doesn't anyone know how to add a schedule to the main one? Just

#property indicator_separate_window    // Индик. рисуется в новом окне
//#property indicator_chart_window     // Индик. рисуется в основном окне

Turns out not enough, although there is a graph in the additional window. It can't be displayed in the main one...

 
sergey087:

Doesn't anyone know how to add a schedule to the main one? Just


Turns out not enough, although there is a graph in the additional window. It can't be displayed in the main one...

One indicator (one copy of the file): one window - either main or additional. There is no way to simultaneously display it in the main window and in the additional window.

 
Juer:

What about re-opening in the futures market, for example? Pos_id changes as far as I remember. The Pos_id remains the same when reversing, at least it used to, I don't know how it is now.

You don't need to fill your memory chip with unnecessary information which you can read in the documentation.

POSITION_IDENTIFIER

The position identifier is a unique number that is assigned to each newly opened position and does not change throughout its life. It corresponds to the ticket of the order with which the position was opened.

The position identifier is specified in each order (ORDER_POSITION_ID) and each trade (DEAL_POSITION_ID) which opened, changed or closed it. Use this property to search for orders and trades related to the position.

When a position is reversed in netting mode (a single in/out trade), the POSITION_IDENTIFIER identifier of the position is not changed. However, POSITION_TICKET is changed to the order ticket which resulted in the reversal. In the hedging mode, there is no position reversal.

In this case, it seems that we have to select trades within a period of time and filter out the necessary ones by DEAL_POSITION_ID in the loop

 
Vladimir Karputov:

One indicator (one copy of the file): one window - either main or auxiliary. There is no way to get both the main window and the sub window at the same time.

So I comment the extra one, but it doesn't appear in the main one. Here's a link to the full script, but it doesn't work and I don't know how to fix it....
 
sergey087:
That's how I comment out the extra, but it doesn't show up for the most part. Here's a link to the full script, but it doesn't work and I don't know how to fix it....

I don't see an mql5 file. It's a good style to attach an mq5 file to your post - then you can download it by one click and open it in the editor. That's just lyricism and bitching :)


If you prescribe in the file to run in the main window, compile and BREAK it on a chart, then to run it in an additional window, you need to: Unload the indicator from the chart, then prescribe the run in an additional window, compile and only then BREAK again.

 
Vladimir Karputov:

Do you have a fast internet connection? If help is not opening, it means that it is being downloaded. There used to be a message in the Logbook about the upload process, now the messages have been removed.

"MQl5 Guide" appeared (I guess you're right about the Internet, here at the hotel is pretty bad). But still, pressing F1 on the function does not open the guide.

 
Vladimir Karputov:

I don't see an mql5 file. It's a good style to attach an mq5 file to your post - then you can download it by one click and open it in the editor. That's just lyricism and bitching :)


If you prescribed in the file the start in the main window, compiled and BREAK it on the chart, then to run it in an additional window, you need: ESCRIVE the indicator from the chart, then prescribe the start in an additional window, compile and only then BREAK again.

And here it is, in fact... Only 4 not 5...
Files:
TechIndI.mq4  6 kb
 
What operator can be used from which 2 results can be returned? I use the if statement to find this condition, but it cannot return multiple results in which case I have to write the same condition 2 times, which is why I am writing with this question.
 
Seric29:
What operator can be used that can return 2 results? I use if statement to find this condition, but it cannot return multiple results, in this case I have to write the same condition twice, that's why I am writing this question.
The if statement does not return any value.

There are two options for assigning values to certain variables in a separate function:

1. Variables must be visible in all parts of the program. That is, they must be declared at the global variable level (at the beginning of the code).

2. To pass variables declared locally to the user function by reference. That is, it must be preceded by &

Reason: