Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1247

 
Maxim Kuznetsov:

you know that for something like thishttps://www.mql5.com/ru/job

and here - if you started to do it yourself, but it didn't work out or you don't understand it.

There's a minimum of 30, I'm willing to figure it out, and I'm willing to thank whoever provides the solution.

Sorry, I'm off https://www.mql5.com/ru/forum/347770/page6#comment_18190964
 

Where are the methods, what are they and how do they work?

input ENUM_MA_METHOD Method=MODE_SMA;

Label1Buffer[i] = iMA(NULL,0,SMA1,0,Method,PRICE_CLOSE,i - SMA1/2);

I can't find a description of this miracle!

 
neverness:

Where are the methods, what are they and how do they work?

input ENUM_MA_METHOD Method=MODE_SMA;

Label1Buffer[i] = iMA(NULL,0,SMA1,0,Method,PRICE_CLOSE,i - SMA1/2);

I can't find a description of this miracle!

Put your cursor in the editor on ENUM_MA_METHOD and press F1, and "... How many wondrous discoveries the spirit of enlightenment prepares for us . .."
 
Artyom Trishkin:
Put your cursor in the editor at ENUM_MA_METHOD and press F1, and "... Oh, how many wondrous discoveries the spirit of enlightenment prepares for us ..."

So what? Turns up

how to get help in windows 10

Why do I need help in windows 10?

How to create a custom METHOD in MQL?

 
neverness:

So what? Turns up

how to get help in windows 10

Why would I need help in windows 10?

Can you translate this message? Even without a translator, it's not a question about windows 10 help, it's "how do you want to get help in windows 10?"

It turns out you haven't configured what to open the help files with.

No time to guess.

But for everyone else, when you press F1 on function, enumeration, etc. in MetaEditor, it opens MQL help on the topic, where the cursor is in the code.

 

Hello @Artyom Trishkin ,

I have a question. I hope you can help me.

I want to know how I can calculate the margin of already open positions.

I have this: https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_double

Where it says something like this:

SYMBOL_CALC_MODE_FOREX

Mode forex - profit and margin calculation for forex

Margin: Lots * Contract_Size / Leverage * Margin_Rate

Profit: (close_price - open_price) * Contract_Size * Lots


But I don't know what values to put and how to get the field values that are displayed in the toolbar.

The toolbar shows it for all currencies, but I want to get the value for the symbols separately.

Can you help me please?

Документация по MQL5: Константы, перечисления и структуры / Состояние окружения / Информация об инструменте
Документация по MQL5: Константы, перечисления и структуры / Состояние окружения / Информация об инструменте
  • www.mql5.com
Для получения текущей рыночной информации служат функции SymbolInfoInteger(), SymbolInfoDouble() и SymbolInfoString(). В качестве второго параметра этих функций допустимо передавать один из идентификаторов из перечислений ENUM_SYMBOL_INFO_INTEGER, ENUM_SYMBOL_INFO_DOUBLE и ENUM_SYMBOL_INFO_STRING соответственно. Некоторые символы (как правило...
 
jaffer wilson:

Hello @Artyom Trishkin ,

I have a question. I hope you can help me.

I want to know how I can calculate the margin of already open positions.

I have this: https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_double

Where it says something like this:

SYMBOL_CALC_MODE_FOREX

Mode forex - profit and margin calculation for forex

Margin: Lots * Contract_Size / Leverage * Margin_Rate

Profit: (close_price - open_price) * Contract_Size * Lots


But I don't know what values to put and how to get the field values that are displayed in the toolbar.

The toolbar shows it for all currencies, but I want to get the value for the symbols separately.

Can you help me please?

Pass the position symbol, type and lot to the function. The function will return the margin.

double  SymbolMargin(string aSymbol, ENUM_ORDER_TYPE aType = ORDER_TYPE_BUY, double aLot = 1.0)
  {

   double margin = 0;

   MqlTick m_tick;
   if(SymbolInfoTick(aSymbol , m_tick))
     {
      if(m_tick.ask != 0.0)
         if(OrderCalcMargin(aType, aSymbol , aLot, m_tick.ask, margin))
            return (margin * aLot);
      if(m_tick.bid != 0.0)
         if(OrderCalcMargin(aType, aSymbol , aLot, m_tick.bid, margin))
            return (margin * aLot);
     }

   return -1;
  }


 
Artyom Trishkin:

Can you translate this message? Even without a translator you can see that the question is not about windows10 help but "how do you want to get help in windows10 ?".

It turns out you haven't configured what to open the help files with.

No time to guess.

However, in MetaEditor, pressing F1 on a function, enumeration, etc. will open MQL help on the subject, where the cursor is positioned in the code.

I can open MQL help without F1.

It is already open. Therefore, your "naughty childish cleverness" with colours of childish surprise is inappropriate.

I can't find an answer to a simple question in the help:

How to create a custom METHOD in MQL?

Or is this not possible in MQL???

 
neverness:

I can open the MQL help without F1.

And I have it open as it is. So your "naughty childish cleverness", colours of childish surprise, is inappropriate.

I can't find an answer to a simple question in the help:

How to create a custom METHOD in MQL?

Or is it impossible in MQL???

I thought about it and decided that a 24 hours of reading books on the rules of good manners will do you good. Being rude never made a man beautiful.

A method is a function. Methods are usually called functions of a class. I.e., a method of a class is nothing but an ordinary function. But a method of a class only belongs to its class, and can be accessible from the outside, or only within the class itself, or in its descendants. Method accessibility is determined by its specifier - in what area of class a method is declared, such access will be applied to the method(public - public method, protected - protected, private - private, hidden, virtual - virtual).

But your original question was about constant ENUM_MA_METHOD, not about methods.

A properly composed question is half the answer (which you never got - you prefer to be rude).

 
Vladimir Pastushak :

Pass the position symbol, type and lot to the function. The function will return the margin.



@ Artyom Trishkin @ Vladimir Pastushak

Doesn't work in my case. I'm not asking for a new position. I know it calculates and returns margin for one type of trade. But it is useless if a trade is already open and I want to know the margin consumed by one trade of a particular symbol.

Can you help me please? If you don't understand my situation, let me know.

Simple explanation of the scenario:

You see this field in ToolBox:

This is the margin for the symbols: AUDJPY, EURUSD and EURTRY.

I know I can get this value with AccountInfoDouble (ACCOUNT_MARGIN). But I can't get the value of a specific symbol. For example, I want to know how much margin EURUSD is consuming. That I can't perform any function. Hence, I want to know how I can calculate it.

I hope this explanation is enough to make sense.

Reason: