Questions from Beginners MQL5 MT5 MetaTrader 5 - page 726

 

Have a variable for example :

double NLb=0,NLs=0;

How do I send it to another terminal?

from mt4 to mt4 , mt4 to mt5 ,

I have an idea I want to try

 
Alexander Antoshkin:

Have a variable for example :

double NLb=0,NLs=0;

How do I send it to another terminal?

from mt4 to mt4 , mt4 to mt5 ,

I have an idea I want to try

Write in a file in a common folder of all terminals.
 

How do I send it to a public folder?

double NLb=0,NLs=0;

and how do I get it out of an EA or indicator in another terminal?
 
Alexander Antoshkin:

How do I send it to the public folder?

double NLb=0,NLs=0;

and then how to get it out of an EA or indicator of another terminal?


It's easy.

You need to create a file, a text file can be created,

The file will be located in COMMON_PATH.

You overwrite the file with the data.

On the other terminal, it's the same, but instead of SHAREWRITE you put SHAREREAD

https://www.mql5.com/ru/docs/files/fileopen

Start by reading the help, it's all there.

If you don't have the skills to do it. Contact Freelance.

Документация по MQL5: Файловые операции / FileOpen
Документация по MQL5: Файловые операции / FileOpen
  • www.mql5.com
Файловые операции / FileOpen - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Документация по MQL5: Стандартная библиотека / Файлы
Документация по MQL5: Стандартная библиотека / Файлы
  • www.mql5.com
Стандартная библиотека / Файлы - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Navyinvader:

Hello all.

I am a beginner in this field and to me it seems unreal to write any advisors, scripts etc.

Could you, as an experienced user, please advise me what to start working with first, what literature to pay attention to, etc.

I just can't describe in detail what I want to learn, because I know very little about this field.

Thank you in advance!

Start with the simplest scripts and go through them with a debugger to understand the programming language itself. Learn if, for, switch, do statements, function calls with parameters passed. All of this under the debugger.

Then write here again ))

 
Comments not related to this topic have been moved to "Questions from MQL4 MT4 MetaTrader 4 beginners".
 
Comments not related to this topic have been moved to "Questions from MQL4 MT4 MetaTrader 4 beginners".
 

Can you tell me how to select an object when it is created, so that it doesn't lose its selection and doesn't select itself when the user deselects it. It was easy in the fourth, but it doesn't work in the fifth.

It used to be, and it worked just fine:

void SetHLine(...,double p,bool sel) {
  if(ObjectFind(chart_ID,nm)!=0) {
    ObjectCreate(chart_ID,nm,OBJ_HLINE,0,0,0);
    ObjectSetInteger(chart_ID,nm,OBJPROP_SELECTED,sel);
    ...
  }
   ObjectSetDouble(chart_ID,nm,OBJPROP_PRICE,p);
}

As you can see, when creating, we can select or not select the object being created at once and it will not change anymore and there will be no reference to it, but it doesn't work in the fifth one, it creates it without selection.

How to make mql5 so that the object can be selected at creation and then manually manage it when needed - to select/not to select

 
Vitaly Muzichenko:

Can you tell me how to select an object when it's created, so that it doesn't lose its selection and doesn't select itself when the user deselects it. It was easy in the fourth, but it doesn't work in the fifth.

It used to be, and it worked just fine:

void SetHLine(...,double p,bool sel) {
  if(ObjectFind(chart_ID,nm)!=0) {
    ObjectCreate(chart_ID,nm,OBJ_HLINE,0,0,0);
    ObjectSetInteger(chart_ID,nm,OBJPROP_SELECTED,sel);
    ...
  }
   ObjectSetDouble(chart_ID,nm,OBJPROP_PRICE,p);
}

As you can see, when creating, we can select or not select the object being created at once and it will not change anymore and there will be no reference to it, but it doesn't work in the fifth one, it creates it without selection.

How can I make mql5 create an object so that it could be selected and then manipulated manually when necessary - to select/not select an object?

Do the following:

//--- включим (true) или отключим (false) режим выделения прямоугольника для перемещений
//--- при создании графического объекта функцией ObjectCreate, по умолчанию объект
//--- нельзя выделить и перемещать. Внутри же этого метода параметр selection
//--- по умолчанию равен true, что позволяет выделять и перемещать этот объект
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);


"selection" here should be "true".

Reason: